24 lines
362 B
Go
24 lines
362 B
Go
package fs
|
|
|
|
import "os"
|
|
|
|
// Exists returns if a file exists
|
|
func Exists(path string) bool {
|
|
if _, err := os.Stat(path); os.IsNotExist(err) {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
// IsDir returns if path is a directory
|
|
func IsDir(path string) bool {
|
|
info, err := os.Stat(path)
|
|
if err != nil {
|
|
return false
|
|
}
|
|
if info.IsDir() {
|
|
return true
|
|
}
|
|
return false
|
|
}
|