Add util
This commit is contained in:
15
util/file/file.go
Normal file
15
util/file/file.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package file
|
||||
|
||||
import "os"
|
||||
|
||||
// Exists returns true if the path is existing
|
||||
func Exists(path string) (bool, error) {
|
||||
_, err := os.Stat(path)
|
||||
if err == nil {
|
||||
return true, nil
|
||||
}
|
||||
if os.IsNotExist(err) {
|
||||
return false, nil
|
||||
}
|
||||
return true, err
|
||||
}
|
||||
Reference in New Issue
Block a user