diff --git a/common/os.go b/common/os.go index 9dc81c579..c19322baa 100644 --- a/common/os.go +++ b/common/os.go @@ -48,7 +48,12 @@ func EnsureDir(dir string, mode os.FileMode) error { func IsDirEmpty(name string) (bool, error) { f, err := os.Open(name) if err != nil { - return true, err //folder is non-existent + if os.IsNotExist(err) { + return true, err + } + // Otherwise perhaps a permission + // error or some other error. + return false, err } defer f.Close()