Skip to content

Commit

Permalink
Enhance file existence check to catch permission errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Piccirello committed Jan 18, 2020
1 parent 9a5f032 commit 5e8afeb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/utils/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ func HomeDir() string {
return dir
}

// Exists whether path exists
// Exists whether path exists and the user has permission
func Exists(path string) bool {
if _, err := os.Stat(path); os.IsNotExist(err) {
if _, err := os.Stat(path); os.IsNotExist(err) || os.IsPermission(err) {
return false
}
return true
Expand Down

0 comments on commit 5e8afeb

Please sign in to comment.