diff options
Diffstat (limited to 'internal/osutil/osutil.go')
-rw-r--r-- | internal/osutil/osutil.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/internal/osutil/osutil.go b/internal/osutil/osutil.go index 656f2e2a..827988a0 100644 --- a/internal/osutil/osutil.go +++ b/internal/osutil/osutil.go @@ -17,6 +17,12 @@ func IsFile(path string) bool { return !f.IsDir() } +// IsExist returns true if a file or directory exists. +func IsExist(path string) bool { + _, err := os.Stat(path) + return err == nil || os.IsExist(err) +} + // CurrentUsername returns the current system user via environment variables. func CurrentUsername() string { curUserName := os.Getenv("USER") |