diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2018-08-16 19:20:59 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2018-08-16 19:20:59 +1000 |
commit | df7d1df4cbad9065c29fef08d3e8d143d8836b3f (patch) | |
tree | 86844bd39d2573f2abd60dbeb9f8b434e746022a /vendor/github.com/shibukawa/configdir/config_xdg.go | |
parent | 5819e04c537d729afc66fb61e529f546c06e094a (diff) |
bump dependencies
Diffstat (limited to 'vendor/github.com/shibukawa/configdir/config_xdg.go')
-rw-r--r-- | vendor/github.com/shibukawa/configdir/config_xdg.go | 34 |
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") + } +} |