summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndinus <andinus@nand.sh>2020-04-06 22:18:33 +0530
committerAndinus <andinus@nand.sh>2020-04-06 22:18:33 +0530
commit58644f4ccc72550481c5d0cc15360dfa40b6c648 (patch)
treef7a60dba6b0e0aacae84b31a3570f4360f72cf76
parentda2255557fa395eeabeff9a4f2949582f8811980 (diff)
downloadgrus-58644f4ccc72550481c5d0cc15360dfa40b6c648.tar.gz
Define GetDir on macOS
-rw-r--r--storage/getdir_darwin.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/storage/getdir_darwin.go b/storage/getdir_darwin.go
new file mode 100644
index 0000000..8d6ebbf
--- /dev/null
+++ b/storage/getdir_darwin.go
@@ -0,0 +1,22 @@
+// +build darwin
+
+package storage
+
+import (
+	"fmt"
+	"os"
+)
+
+// GetDir returns grus data directory. Default data directory on
+// macOS is $HOME/Library.
+func GetDir() string {
+	cacheDir := fmt.Sprintf("%s/%s",
+		os.Getenv("HOME"),
+		"Library")
+
+	// Grus cache directory is cacheDir/grus
+	grusCacheDir := fmt.Sprintf("%s/%s", cacheDir,
+		"grus")
+
+	return grusCacheDir
+}