aboutsummaryrefslogtreecommitdiff
path: root/internal/osutil/osutil.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/osutil/osutil.go')
-rw-r--r--internal/osutil/osutil.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/internal/osutil/osutil.go b/internal/osutil/osutil.go
index 3af67570..b2205a46 100644
--- a/internal/osutil/osutil.go
+++ b/internal/osutil/osutil.go
@@ -17,6 +17,16 @@ func IsFile(path string) bool {
return !f.IsDir()
}
+// IsDir returns true if given path is a directory, and returns false when it's
+// a file or does not exist.
+func IsDir(dir string) bool {
+ f, e := os.Stat(dir)
+ if e != nil {
+ return false
+ }
+ return f.IsDir()
+}
+
// IsExist returns true if a file or directory exists.
func IsExist(path string) bool {
_, err := os.Stat(path)