Skip to content

Commit

Permalink
Add FileExists helper function to os package
Browse files Browse the repository at this point in the history
  • Loading branch information
anjannath authored and praveenkumar committed Jan 27, 2020
1 parent f10526b commit 724fb2b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/os/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,11 @@ func WriteFileIfContentChanged(path string, new_content []byte, perm os.FileMode
}
return true, nil
}

func FileExists(path string) bool {
_, err := os.Stat(path)
if err != nil && os.IsNotExist(err) {
return false
}
return true
}

0 comments on commit 724fb2b

Please sign in to comment.