1
0
Fork 0
mirror of https://gitlab.alpinelinux.org/alpine/aports.git synced 2025-07-19 01:05:15 +03:00
aports/testing/lab/xdg.patch

27 lines
758 B
Diff

From 63bb26a320d43f8ce79626b0adeeaae73f90fd8a Mon Sep 17 00:00:00 2001
From: Leo <thinkabit.ukim@gmail.com>
Date: Thu, 25 Jul 2019 04:05:41 -0300
Subject: [PATCH] try XDG_CONFIG_HOME
---
main.go | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/main.go b/main.go
index dddf7a3..9a836b9 100644
--- a/main.go
+++ b/main.go
@@ -35,7 +35,11 @@ func loadConfig() (string, string, string) {
home = u.HomeDir
}
}
- confpath := path.Join(home, ".config")
+ // Try XDG_CONFIG_HOME which is declared in XDG base directory specification
+ confpath := os.Getenv("XDG_CONFIG_HOME")
+ if confpath == "" {
+ confpath = path.Join(home, ".config")
+ }
if _, err := os.Stat(confpath); os.IsNotExist(err) {
os.Mkdir(confpath, 0700)
}