summaryrefslogtreecommitdiff
path: root/paths/paths.go
diff options
context:
space:
mode:
authorewy <ewy0@protonmail.com>2026-04-14 16:37:17 +0200
committerewy <ewy0@protonmail.com>2026-04-14 16:37:17 +0200
commit45a297a8e526094e8fce6e2c5c0fd89b381d1765 (patch)
tree852ebc3a0112c94dc9726d0b27ab057bf6383660 /paths/paths.go
i have to commit at some point!
Diffstat (limited to 'paths/paths.go')
-rw-r--r--paths/paths.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/paths/paths.go b/paths/paths.go
new file mode 100644
index 0000000..0445658
--- /dev/null
+++ b/paths/paths.go
@@ -0,0 +1,31 @@
+package paths
+
+import (
+ "github.com/adrg/xdg"
+ "os"
+ "path/filepath"
+ "pik/spool"
+ "strings"
+)
+
+var (
+ Home = xdg.Home
+ This = "pik"
+ Cache = filepath.Join(xdg.CacheHome, This)
+ Config = filepath.Join(xdg.ConfigHome, This)
+)
+
+func init() {
+ err := os.MkdirAll(Cache, 0700)
+ if err != nil {
+ spool.Warn("%v\n", err)
+ }
+ err = os.MkdirAll(Config, 0700)
+ if err != nil {
+ spool.Warn("%v\n", err)
+ }
+}
+
+func ReplaceHome(input string) string {
+ return strings.Replace(input, Home, "~", 1)
+}