add exists

This commit is contained in:
Zack Scholl 2018-09-21 21:56:47 -07:00
parent 80471c7d02
commit a225a08dbc
1 changed files with 13 additions and 0 deletions

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
}