file.go raw

   1  package cfgutil
   2  
   3  import (
   4  	"os"
   5  )
   6  
   7  // FileExists reports whether the named file or directory exists.
   8  func FileExists(filePath string) (bool, error) {
   9  	_, e := os.Stat(filePath)
  10  	if e != nil {
  11  		E.Ln(e)
  12  		if os.IsNotExist(e) {
  13  			return false, nil
  14  		}
  15  		return false, e
  16  	}
  17  	return true, nil
  18  }
  19