mirror of
https://github.com/schollz/croc.git
synced 2025-10-11 13:21:00 +02:00
add exists
This commit is contained in:
parent
80471c7d02
commit
a225a08dbc
1 changed files with 13 additions and 0 deletions
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…
Add table
Add a link
Reference in a new issue