1
0
mirror of https://github.com/schollz/croc.git synced 2024-11-28 01:16:10 +03:00

add exists

This commit is contained in:
Zack Scholl 2018-09-21 21:56:47 -07:00
parent 80471c7d02
commit a225a08dbc

13
src/utils/exists.go Normal file
View File

@ -0,0 +1,13 @@
package utils
import "os"
// Exists reports whether the named file or directory exists.
func Exists(name string) bool {
if _, err := os.Stat(name); err != nil {
if os.IsNotExist(err) {
return false
}
}
return true
}