summaryrefslogtreecommitdiffstats
path: root/lib/common/filepath.go
diff options
context:
space:
mode:
Diffstat (limited to 'lib/common/filepath.go')
-rw-r--r--lib/common/filepath.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/common/filepath.go b/lib/common/filepath.go
new file mode 100644
index 0000000..603c2a2
--- /dev/null
+++ b/lib/common/filepath.go
@@ -0,0 +1,15 @@
+package common
+
+import "os"
+
+// Exists returns whether the given file or directory exists or not
+func Exists(path string) bool {
+ _, err := os.Stat(path)
+ if err == nil {
+ return true
+ }
+ if os.IsNotExist(err) {
+ return false
+ }
+ return true
+}