misc: add Exists()

This commit is contained in:
Clayton Craft
2023-02-12 13:37:20 -08:00
parent 4176a8a661
commit e0977b4ac1

View File

@@ -114,3 +114,11 @@ func GetKernelVersion() (string, error) {
return strings.TrimSpace(string(contents)), nil
}
// Exists tests if the given file/dir exists or not
func Exists(file string) bool {
if _, err := os.Stat(file); err == nil {
return true
}
return false
}