summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/shibukawa/configdir/config_xdg.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/shibukawa/configdir/config_xdg.go')
-rw-r--r--vendor/github.com/shibukawa/configdir/config_xdg.go34
1 files changed, 34 insertions, 0 deletions
diff --git a/vendor/github.com/shibukawa/configdir/config_xdg.go b/vendor/github.com/shibukawa/configdir/config_xdg.go
new file mode 100644
index 000000000..026ca68a0
--- /dev/null
+++ b/vendor/github.com/shibukawa/configdir/config_xdg.go
@@ -0,0 +1,34 @@
+// +build !windows,!darwin
+
+package configdir
+
+import (
+ "os"
+ "path/filepath"
+ "strings"
+)
+
+// https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
+
+var hasVendorName = true
+var systemSettingFolders []string
+var globalSettingFolder string
+var cacheFolder string
+
+func init() {
+ if os.Getenv("XDG_CONFIG_HOME") != "" {
+ globalSettingFolder = os.Getenv("XDG_CONFIG_HOME")
+ } else {
+ globalSettingFolder = filepath.Join(os.Getenv("HOME"), ".config")
+ }
+ if os.Getenv("XDG_CONFIG_DIRS") != "" {
+ systemSettingFolders = strings.Split(os.Getenv("XDG_CONFIG_DIRS"), ":")
+ } else {
+ systemSettingFolders = []string{"/etc/xdg"}
+ }
+ if os.Getenv("XDG_CACHE_HOME") != "" {
+ cacheFolder = os.Getenv("XDG_CACHE_HOME")
+ } else {
+ cacheFolder = filepath.Join(os.Getenv("HOME"), ".cache")
+ }
+}