fs/fs.go

24 lines
362 B
Go
Raw Normal View History

2015-08-09 16:20:47 -07:00
package fs
import "os"
// Exists returns if a file exists
func Exists(path string) bool {
2015-08-09 20:18:41 -07:00
if _, err := os.Stat(path); os.IsNotExist(err) {
2015-08-09 16:20:47 -07:00
return false
}
return true
}
2015-08-09 20:18:41 -07:00
2015-08-23 16:23:26 -07:00
// IsDir returns if path is a directory
2015-08-09 20:18:41 -07:00
func IsDir(path string) bool {
info, err := os.Stat(path)
if err != nil {
return false
}
if info.IsDir() {
return true
}
return false
}