mirror of
https://github.com/schollz/croc.git
synced 2024-11-28 01:16:10 +03:00
add exists
This commit is contained in:
parent
80471c7d02
commit
a225a08dbc
13
src/utils/exists.go
Normal file
13
src/utils/exists.go
Normal 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
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user