summaryrefslogtreecommitdiffstats
path: root/lib/common/filepath.go
diff options
context:
space:
mode:
authorSebastien Douheret <sebastien.douheret@iot.bzh>2017-05-17 17:10:45 +0200
committerSebastien Douheret <sebastien.douheret@iot.bzh>2017-05-17 17:10:45 +0200
commita50baa7c309f7eb55fe87c71f4c688ace325b6ac (patch)
tree14ed08e3abad729bce718bfbd596eb62d1676675 /lib/common/filepath.go
parent59784289d1d0296e470c46dc279aa3576c60801e (diff)
Add logsDir setting and more
- add logsDir setting in config.json - redirect Syncthing and Syncthing-inotify into log files - Use autogenerated Syncthing apikey if gui-apikey not set in config.json
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
+}