mirror of
https://github.com/tendermint/tendermint.git
synced 2026-05-31 19:36:20 +00:00
Merge pull request #34 from orijtech/develop
common/IsDirEmpty: do not mask non-existance errors
This commit is contained in:
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user