mirror of https://github.com/schollz/croc.git
add exists
This commit is contained in:
parent
80471c7d02
commit
a225a08dbc
|
@ -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
|
||||
}
|
Loading…
Reference in New Issue