Browse Source

Better handling of os.Stat() errors (#1173)

pull/1180/head
Meisam 4 years ago committed by GitHub
parent
commit
08b6c4e3cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      utils/utils.go

13
utils/utils.go

@ -22,13 +22,14 @@ import (
// DoesFileExists checks if the file exists. // DoesFileExists checks if the file exists.
func DoesFileExists(name string) bool { func DoesFileExists(name string) bool {
if _, err := os.Stat(name); err != nil { if _, err := os.Stat(name); err == nil {
if os.IsNotExist(err) { return true
return false } else if os.IsNotExist(err) {
} return false
} else {
log.Errorln(err)
return false
} }
return true
} }
// GetRelativePathFromAbsolutePath gets the relative path from the provided absolute path. // GetRelativePathFromAbsolutePath gets the relative path from the provided absolute path.

Loading…
Cancel
Save