* Update file.go
* Update file.go
* Update file.go
Co-authored-by: Welt <L5Accelerator@users.noreply.github.com>
package util
-import "os"
+import (
+ "os"
+)
// FileUtil is a struct of File utility
type FileUtil struct {
// PathExists return if path exists
func PathExists(path string) (bool, error) {
- if _, err := os.Stat(path); err != nil {
- return false, err
+ if _, err := os.Stat(path); os.IsNotExist(err) {
+ return false, nil
+ } else {
+ return err == nil, err
}
-
- return true, nil
}
// RemoveLocal deletes file