summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Haller <stefan@haller-berlin.de>2024-02-18 15:54:55 +0100
committerGitHub <noreply@github.com>2024-02-18 15:54:55 +0100
commitb0f3bb7a9ab4390a507f0f0b5b46c1d9b9667272 (patch)
treee45575c5d823c95923ba6f0a05b633e2f5ac1fd0
parent43020184373abb624971bb81aebd34ea214addee (diff)
parentc7c877637167e24f3425a2f7042295cf0082537e (diff)
Use $XDG_STATE_HOME for state.yml (#2936)
- **PR Description** fixes #2856, #2794, #818
-rw-r--r--docs/Config.md2
-rw-r--r--go.mod2
-rw-r--r--go.sum6
-rw-r--r--pkg/config/app_config.go61
-rw-r--r--vendor/github.com/OpenPeeDeeP/xdg/.gitignore3
-rw-r--r--vendor/github.com/OpenPeeDeeP/xdg/LICENSE29
-rw-r--r--vendor/github.com/OpenPeeDeeP/xdg/README.md25
-rw-r--r--vendor/github.com/OpenPeeDeeP/xdg/appveyor.yml16
-rw-r--r--vendor/github.com/OpenPeeDeeP/xdg/xdg.go163
-rw-r--r--vendor/github.com/OpenPeeDeeP/xdg/xdg_bsd.go32
-rw-r--r--vendor/github.com/OpenPeeDeeP/xdg/xdg_darwin.go30
-rw-r--r--vendor/github.com/OpenPeeDeeP/xdg/xdg_linux.go30
-rw-r--r--vendor/github.com/OpenPeeDeeP/xdg/xdg_windows.go27
-rw-r--r--vendor/github.com/adrg/xdg/CODE_OF_CONDUCT.md77
-rw-r--r--vendor/github.com/adrg/xdg/CONTRIBUTING.md135
-rw-r--r--vendor/github.com/adrg/xdg/LICENSE21
-rw-r--r--vendor/github.com/adrg/xdg/README.md280
-rw-r--r--vendor/github.com/adrg/xdg/base_dirs.go68
-rw-r--r--vendor/github.com/adrg/xdg/codecov.yml11
-rw-r--r--vendor/github.com/adrg/xdg/doc.go99
-rw-r--r--vendor/github.com/adrg/xdg/internal/pathutil/pathutil.go78
-rw-r--r--vendor/github.com/adrg/xdg/internal/pathutil/pathutil_plan9.go29
-rw-r--r--vendor/github.com/adrg/xdg/internal/pathutil/pathutil_unix.go32
-rw-r--r--vendor/github.com/adrg/xdg/internal/pathutil/pathutil_windows.go64
-rw-r--r--vendor/github.com/adrg/xdg/paths_darwin.go60
-rw-r--r--vendor/github.com/adrg/xdg/paths_plan9.go55
-rw-r--r--vendor/github.com/adrg/xdg/paths_unix.go71
-rw-r--r--vendor/github.com/adrg/xdg/paths_windows.go168
-rw-r--r--vendor/github.com/adrg/xdg/user_dirs.go40
-rw-r--r--vendor/github.com/adrg/xdg/xdg.go218
-rw-r--r--vendor/modules.txt7
31 files changed, 1553 insertions, 386 deletions
diff --git a/docs/Config.md b/docs/Config.md
index b5c854d29..5b686fc19 100644
--- a/docs/Config.md
+++ b/docs/Config.md
@@ -4,7 +4,7 @@ Default path for the config file:
- Linux: `~/.config/lazygit/config.yml`
- MacOS: `~/Library/Application\ Support/lazygit/config.yml`
-- Windows: `%APPDATA%\lazygit\config.yml`
+- Windows: `%LOCALAPPDATA%\lazygit\config.yml` (default location, but it will also be found in `%APPDATA%\lazygit\config.yml`
For old installations (slightly embarrassing: I didn't realise at the time that you didn't need to supply a vendor name to the path so I just used my name):
diff --git a/go.mod b/go.mod
index 64ecc4c6d..329e0f0e8 100644
--- a/go.mod
+++ b/go.mod
@@ -3,7 +3,7 @@ module github.com/jesseduffield/lazygit
go 1.21
require (
- github.com/OpenPeeDeeP/xdg v1.0.0
+ github.com/adrg/xdg v0.4.0
github.com/atotto/clipboard v0.1.4
github.com/aybabtme/humanlog v0.4.1
github.com/cloudfoundry/jibber_jabber v0.0.0-20151120183258-bcc4c8345a21
diff --git a/go.sum b/go.sum
index 733c1c268..414385b54 100644
--- a/go.sum
+++ b/go.sum
@@ -38,8 +38,8 @@ cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3f
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
-github.com/OpenPeeDeeP/xdg v1.0.0 h1:UDLmNjCGFZZCaVMB74DqYEtXkHxnTxcr4FeJVF9uCn8=
-github.com/OpenPeeDeeP/xdg v1.0.0/go.mod h1:tMoSueLQlMf0TCldjrJLNIjAc5qAOIcHt5REi88/Ygo=
+github.com/adrg/xdg v0.4.0 h1:RzRqFcjH4nE5C6oTAxhBtoE2IRyjBSa62SCbyPidvls=
+github.com/adrg/xdg v0.4.0/go.mod h1:N6ag73EX4wyxeaoeHctc1mas01KZgsj5tYiAIwqJE/E=
github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7 h1:uSoVVbwJiQipAclBbw+8quDsfcvFjOpI5iCf4p/cqCs=
github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7/go.mod h1:6zEj6s6u/ghQa61ZWa/C2Aw3RkjiTBOix7dkqa1VLIs=
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239 h1:kFOfPq6dUM1hTo4JG6LR5AXSUEsOjtdm0kw0FtQtMJA=
@@ -286,7 +286,6 @@ github.com/spkg/bom v0.0.0-20160624110644-59b7046e48ad/go.mod h1:qLr4V1qq6nMqFKk
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
-github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/testify v0.0.0-20161117074351-18a02ba4a312/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
@@ -468,6 +467,7 @@ golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
diff --git a/pkg/config/app_config.go b/pkg/config/app_config.go
index ec539a757..67852dcd1 100644
--- a/pkg/config/app_config.go
+++ b/pkg/config/app_config.go
@@ -6,7 +6,7 @@ import (
"path/filepath"
"strings"
- "github.com/OpenPeeDeeP/xdg"
+ "github.com/adrg/xdg"
"github.com/jesseduffield/lazygit/pkg/utils/yaml_utils"
yaml "github.com/jesseduffield/yaml"
)
@@ -113,21 +113,9 @@ func isCustomConfigFile(path string) bool {
}
func ConfigDir() string {
- legacyConfigDirectory := configDirForVendor("jesseduffield")
- if _, err := os.Stat(legacyConfigDirectory); !os.IsNotExist(err) {
- return legacyConfigDirectory
- }
- configDirectory := configDirForVendor("")
- return configDirectory
-}
+ _, filePath := findConfigFile("config.yml")
-func configDirForVendor(vendor string) string {
- envConfigDir := os.Getenv("CONFIG_DIR")
- if envConfigDir != "" {
- return envConfigDir
- }
- configDirs := xdg.New(vendor, "lazygit")
- return configDirs.ConfigHome()
+ return filepath.Dir(filePath)
}
func findOrCreateConfigDir() (string, error) {
@@ -255,17 +243,42 @@ func (c *AppConfig) GetTempDir() string {
return c.TempDir
}
-func configFilePath(filename string) (string, error) {
- folder, err := findOrCreateConfigDir()
- if err != nil {
- return "", err
+// findConfigFile looks for a possibly existing config file.
+// This function does NOT create any folders or files.
+func findConfigFile(filename string) (exists bool, path string) {
+ if envConfigDir := os.Getenv("CONFIG_DIR"); envConfigDir != "" {
+ return true, filepath.Join(envConfigDir, filename)
}
- return filepath.Join(folder, filename), nil
+ // look for jesseduffield/lazygit/filename in XDG_CONFIG_HOME and XDG_CONFIG_DIRS
+ legacyConfigPath, err := xdg.SearchConfigFile(filepath.Join("jesseduffield", "lazygit", filename))
+ if err == nil {
+ return true, legacyConfigPath
+ }
+
+ // look for lazygit/filename in XDG_CONFIG_HOME and XDG_CONFIG_DIRS
+ configFilepath, err := xdg.SearchConfigFile(filepath.Join("lazygit", filename))
+ if err == nil {
+ return true, configFilepath
+ }
+
+ return false, filepath.Join(xdg.ConfigHome, "lazygit", filename)
}
var ConfigFilename = "config.yml"
+// stateFilePath looks for a possibly existing state file.
+// if none exist, the default path is returned and all parent directories are created.
+func stateFilePath(filename string) (string, error) {
+ exists, legacyStateFile := findConfigFile(filename)
+ if exists {
+ return legacyStateFile, nil
+ }
+
+ // looks for XDG_STATE_HOME/lazygit/filename
+ return xdg.StateFile(filepath.Join("lazygit", filename))
+}
+
// ConfigFilename returns the filename of the default config file
func (c *AppConfig) ConfigFilename() string {
return filepath.Join(c.UserConfigDir, ConfigFilename)
@@ -278,7 +291,7 @@ func (c *AppConfig) SaveAppState() error {
return err
}
- filepath, err := configFilePath("state.yml")
+ filepath, err := stateFilePath(stateFileName)
if err != nil {
return err
}
@@ -292,11 +305,13 @@ func (c *AppConfig) SaveAppState() error {
return err
}
+var stateFileName = "state.yml"
+
// loadAppState loads recorded AppState from file
func loadAppState() (*AppState, error) {
appState := getDefaultAppState()
- filepath, err := configFilePath("state.yml")
+ filepath, err := stateFilePath(stateFileName)
if err != nil {
if os.IsPermission(err) {
// apparently when people have read-only permissions they prefer us to fail silently
@@ -365,5 +380,5 @@ func LogPath() (string, error) {
return os.Getenv("LAZYGIT_LOG_PATH"), nil
}
- return configFilePath("development.log")
+ return stateFilePath("development.log")
}
diff --git a/vendor/github.com/OpenPeeDeeP/xdg/.gitignore b/vendor/github.com/OpenPeeDeeP/xdg/.gitignore
deleted file mode 100644
index 602b812f3..000000000
--- a/vendor/github.com/OpenPeeDeeP/xdg/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-*.test
-*.out
-.DS_STORE
diff --git a/vendor/github.com/OpenPeeDeeP/xdg/LICENSE b/vendor/github.com/OpenPeeDeeP/xdg/LICENSE
deleted file mode 100644
index 2a4648d4f..000000000
--- a/vendor/github.com/OpenPeeDeeP/xdg/LICENSE
+++ /dev/null
@@ -1,29 +0,0 @@
-BSD 3-Clause License
-
-Copyright (c) 2017, OpenPeeDeeP
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-* Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
-* Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
-* Neither the name of the copyright holder nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/vendor/github.com/OpenPeeDeeP/xdg/README.md b/vendor/github.com/OpenPeeDeeP/xdg/README.md
deleted file mode 100644
index 74ee71dba..000000000
--- a/vendor/github.com/OpenPeeDeeP/xdg/README.md
+++ /dev/null
@@ -1,25 +0,0 @@
-# XDG [![Build status](https://ci.appveyor.com/api/projects/status/9eoupq9jgsu2p0jv?svg=true)](https://ci.appveyor.com/project/dixonwille/xdg) [![Build Status](https://travis-ci.org/OpenPeeDeeP/xdg.svg?branch=master)](https://travis-ci.org/OpenPeeDeeP/xdg) [![Go Report Card](https://goreportcard.com/badge/github.com/OpenPeeDeeP/xdg)](https://goreportcard.com/report/github.com/OpenPeeDeeP/xdg) [![GoDoc](https://godoc.org/github.com/OpenPeeDeeP/xdg?status.svg)](https://godoc.org/github.com/OpenPeeDeeP/xdg) [![codecov](https://codecov.io/gh/OpenPeeDeeP/xdg/branch/master/graph/badge.svg)](https://codecov.io/gh/OpenPeeDeeP/xdg)
-
-A cross platform package that tries to follow [XDG Standard](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html) when possible. Since XDG is linux specific, I am only able to follow standards to the T on linux. But for the other operating systems I am finding similar best practice locations for the files.
-
-## Locations Per OS
-
-The following table shows what is used if the envrionment variable is not set. If the variable is set then this package uses that. Linux follows the default standards. Mac does when it comes to the home directory but for system wide it uses the standard `/Library/Application Support`. As for Windows, the variable defaults are just other environment variables set up by the operation system.
-
-> When creating `XDG` application the `Vendor` and `Application` names are appeneded to the end of the path to keep projects unique.
-
-| | Linux(and BSD) | Mac | Windows |
-| ---: | :---: | :---: | :---: |
-| `XDG_DATA_DIRS` | [`/usr/local/share`, `/usr/share`] | [`/Library/Application Support`] | `%PROGRAMDATA%` |
-| `XDG_DATA_HOME` | `~/.local/share` | `~/Library/Application Support` | `%APPDATA%` |
-| `XDG_CONFIG_DIRS` | [`/etc/xdg`] | [`/Library/Application Support`] | `%PROGRAMDATA%` |
-| `XDG_CONFIG_HOME` | `~/.config` | `~/Library/Application Support` | `%APPDATA%` |
-| `XDG_CACHE_HOME` | `~/.cache` | `~/Library/Caches` | `%LOCALAPPDATA%` |
-
-## Notes
-
-- This package does not merge files if they exist across different directories.
-- The `Query` methods search through the system variables, `DIRS`, first (when using environment variables first in the variable has presidence). It then checks home variables, `HOME`.
-- This package will not create any directories for you. In the standard, it states the following:
-
-> If, when attempting to write a file, the destination directory is non-existant an attempt should be made to create it with permission `0700`. If the destination directory exists already the permissions should not be changed. The application should be prepared to handle the case where the file could not be written, either because the directory was non-existant and could not be created, or for any other reason. In such case it may chose to present an error message to the user.
diff --git a/vendor/github.com/OpenPeeDeeP/xdg/appveyor.yml b/vendor/github.com/OpenPeeDeeP/xdg/appveyor.yml
deleted file mode 100644
index 807e489a2..000000000
--- a/vendor/github.com/OpenPeeDeeP/xdg/appveyor.yml
+++ /dev/null
@@ -1,16 +0,0 @@
-version: 0.0.1_{build}
-build: off
-platform: x64
-clone_folder: c:\gopath\src\github.com\OpenPeeDeeP\xdg
-environment:
- GOPATH: c:\gopath
-stack: go 1.11
-install:
- - go get -t -v ./...
- - cinst codecov
-before_test:
- - go vet ./...
-test_script:
- - go test -v -race -covermode=atomic -coverprofile=coverage.txt
-on_success:
- - codecov -f coverage.txt
diff --git a/vendor/github.com/OpenPeeDeeP/xdg/xdg.go b/vendor/github.com/OpenPeeDeeP/xdg/xdg.go
deleted file mode 100644
index bb81060b6..000000000
--- a/vendor/github.com/OpenPeeDeeP/xdg/xdg.go
+++ /dev/null
@@ -1,163 +0,0 @@
-// Copyright (c) 2017, OpenPeeDeeP. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package xdg impelements the XDG standard for application file locations.
-package xdg
-
-import (
- "os"
- "path/filepath"
- "strings"
-)
-
-var defaulter xdgDefaulter = new(osDefaulter)
-
-type xdgDefaulter interface {
- defaultDataHome() string
- defaultDataDirs() []string
- defaultConfigHome() string
- defaultConfigDirs() []string
- defaultCacheHome() string
-}
-
-type osDefaulter struct {
-}
-
-//This method is used in the testing suit
-// nolint: deadcode
-func setDefaulter(def xdgDefaulter) {
- defaulter = def
-}
-
-// XDG is information about the currently running application
-type XDG struct {
- Vendor string
- Application string
-}
-
-// New returns an instance of XDG that is used to grab files for application use
-func New(vendor, application string) *XDG {
- return &XDG{
- Vendor: vendor,
- Application: application,
- }
-}
-
-// DataHome returns the location that should be used for user specific data files for this specific application
-func (x *XDG) DataHome() string {
- return filepath.Join(DataHome(), x.Vendor, x.Application)
-}
-
-// DataDirs returns a list of locations that should be used for system wide data files for this specific application
-func (x *XDG) DataDirs() []string {
- dataDirs := DataDirs()
- for i, dir := range dataDirs {
- dataDirs[i] = filepath.Join(dir, x.Vendor, x.Application)
- }
- return dataDirs
-}
-
-// ConfigHome returns the location that should be used for user specific config files for this specific application
-func (x *XDG) ConfigHome() string {
- return filepath.Join(ConfigHome(), x.Vendor, x.Application)
-}
-
-// ConfigDirs returns a list of locations that should be used for system wide config files for this specific application
-func (x *XDG) ConfigDirs() []string {
- configDirs := ConfigDirs()
- for i, dir := range configDirs {
- configDirs[i] = filepath.Join(dir, x.Vendor, x.Application)
- }
- return configDirs
-}
-
-// CacheHome returns the location that should be used for application cache files for this specific application
-func (x *XDG) CacheHome() string {
- return filepath.Join(CacheHome(), x.Vendor, x.Application)
-}
-
-// QueryData looks for the given filename in XDG paths for data files.
-// Returns an empty string if one was not found.
-func (x *XDG) QueryData(filename string) string {
- dirs := x.DataDirs()
- dirs = append([]string{x.DataHome()}, dirs...)
- return returnExist(filename, dirs)
-}
-
-// QueryConfig looks for the given filename in XDG paths for config files.
-// Returns an empty string if one was not found.
-func (x *XDG) QueryConfig(filename string) string {
- dirs := x.ConfigDirs()
- dirs = append([]string{x.ConfigHome()}, dirs...)
- return returnExist(filename, dirs)
-}
-
-// QueryCache looks for the given filename in XDG paths for cache files.
-// Returns an empty string if one was not found.
-func (x *XDG) QueryCache(filename string) string {
- return returnExist(filename, []string{x.CacheHome()})
-}
-
-func returnExist(filename string, dirs []string) string {
- for _, dir := range dirs {
- _, err := os.Stat(filepath.Join(dir, filename))
- if (err != nil && os.IsExist(err)) || err == nil {
- return filepath.Join(dir, filename)
- }
- }
- return ""
-}
-
-// DataHome returns the location that should be used for user specific data files
-func DataHome() string {
- dataHome := os.Getenv("XDG_DATA_HOME")
- if dataHome == "" {
- dataHome = defaulter.defaultDataHome()
- }
- return dataHome
-}
-
-// DataDirs returns a list of locations that should be used for system wide data files
-func DataDirs() []string {
- var dataDirs []string
- dataDirsStr := os.Getenv("XDG_DATA_DIRS")
- if dataDirsStr != "" {
- dataDirs = strings.Split(dataDirsStr, string(os.PathListSeparator))
- }
- if len(dataDirs) == 0 {
- dataDirs = defaulter.defaultDataDirs()
- }
- return dataDirs
-}
-
-// ConfigHome returns the location that should be used for user specific config files
-func ConfigHome() string {
- configHome := os.Getenv("XDG_CONFIG_HOME")
- if configHome == "" {
- configHome = defaulter.defaultConfigHome()
- }
- return configHome
-}
-
-// ConfigDirs returns a list of locations that should be used for system wide config files
-func ConfigDirs() []string {
- var configDirs []string
- configDirsStr := os.Getenv("XDG_CONFIG_DIRS")
- if configDirsStr != "" {
- configDirs = strings.Split(configDirsStr, string(os.PathListSeparator))
- }
- if len(configDirs) == 0 {
- configDirs = defaulter.defaultConfigDirs()
- }
- return configDirs
-}
-
-// CacheHome returns the location that should be used for application cache files
-func CacheHome() string {
- cacheHome := os.Getenv("XDG_CACHE_HOME")
- if cacheHome == "" {
- cacheHome = defaulter.defaultCacheHome()
- }
- return cacheHome
-}
diff --git a/vendor/github.com/OpenPeeDeeP/xdg/xdg_bsd.go b/vendor/github.com/OpenPeeDeeP/xdg/xdg_bsd.go
deleted file mode 100644
index ea99f2fd0..000000000
--- a/vendor/github.com/OpenPeeDeeP/xdg/xdg_bsd.go
+++ /dev/null
@@ -1,32 +0,0 @@
-// +build freebsd openbsd netbsd
-
-// Copyright (c) 2017, OpenPeeDeeP. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package xdg
-
-import (
- "os"
- "path/filepath"
-)
-
-func (o *osDefaulter) defaultDataHome() string {
- return filepath.Join(os.Getenv("HOME"), ".local", "share")
-}
-
-func (o *osDefaulter) defaultDataDirs() []string {
- return []string{"/usr/local/share/", "/usr/share/"}
-}
-
-func (o *osDefaulter) defaultConfigHome() string {
- return filepath.Join(os.Getenv("HOME"), ".config")
-}
-
-func (o *osDefaulter) defaultConfigDirs() []string {
- return []string{"/etc/xdg"}
-}
-
-func (o *osDefaulter) defaultCacheHome() string {
- return filepath.Join(os.Getenv("HOME"), ".cache")
-}
diff --git a/vendor/github.com/OpenPeeDeeP/xdg/xdg_darwin.go b/vendor/github.com/OpenPeeDeeP/xdg/xdg_darwin.go
deleted file mode 100644
index 6711ff967..000000000
--- a/vendor/github.com/OpenPeeDeeP/xdg/xdg_darwin.go
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright (c) 2017, OpenPeeDeeP. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package xdg
-
-import (
- "os"
- "path/filepath"
-)
-
-func (o *osDefaulter) defaultDataHome() string {
- return filepath.Join(os.Getenv("HOME"), "Library", "Application Support")
-}
-
-func (o *osDefaulter) defaultDataDirs() []string {
- return []string{filepath.Join("/Library", "Application Support")}
-}
-
-func (o *osDefaulter) defaultConfigHome() string {
- return filepath.Join(os.Getenv("HOME"), "Library", "Application Support")
-}
-
-func (o *osDefaulter) defaultConfigDirs() []string {
- return []string{filepath.Join("/Library", "Application Support")}
-}
-
-func (o *osDefaulter) defaultCacheHome() string {
- return filepath.Join(os.Getenv("HOME"), "Library", "Caches")
-}
diff --git a/vendor/github.com/OpenPeeDeeP/xdg/xdg_linux.go b/vendor/github.com/OpenPeeDeeP/xdg/xdg_linux.go
deleted file mode 100644
index 3746dea65..000000000
--- a/vendor/github.com/OpenPeeDeeP/xdg/xdg_linux.go
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright (c) 2017, OpenPeeDeeP. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package xdg
-
-import (
- "os"
- "path/filepath"
-)
-
-func (o *osDefaulter) defaultDataHome() string {
- return filepath.Join(os.Getenv("HOME"), ".local", "share")
-}
-
-func (o *osDefaulter) defaultDataDirs() []string {
- return []string{"/usr/local/share/", "/usr/share/"}
-}
-
-func (o *osDefaulter) defaultConfigHome() string {
- return filepath.Join(os.Getenv("HOME"), ".config")
-}
-
-func (o *osDefaulter) defaultConfigDirs() []string {
- return []string{"/etc/xdg"}
-}
-
-func (o *osDefaulter) defaultCacheHome() string {
- return filepath.Join(os.Getenv("HOME"), ".cache")
-}
diff --git a/vendor/github.com/OpenPeeDeeP/xdg/xdg_windows.go b/vendor/github.com/OpenPeeDeeP/xdg/xdg_windows.go
deleted file mode 100644
index 183174b74..000000000
--- a/vendor/github.com/OpenPeeDeeP/xdg/xdg_windows.go
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (c) 2017, OpenPeeDeeP. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package xdg
-
-import "os"
-
-func (o *osDefaulter) defaultDataHome() string {
- return os.Getenv("APPDATA")
-}
-
-func (o *osDefaulter) defaultDataDirs() []string {
- return []string{os.Getenv("PROGRAMDATA")}
-}
-
-func (o *osDefaulter) defaultConfigHome() string {
- return os.Getenv("APPDATA")
-}
-
-func (o *osDefaulter) defaultConfigDirs() []string {
- return []string{os.Getenv("PROGRAMDATA")}
-}
-
-func (o *osDefaulter) defaultCacheHome() string {
- return os.Getenv("LOCALAPPDATA")
-}
diff --git a/vendor/github.com/adrg/xdg/CODE_OF_CONDUCT.md b/vendor/github.com/adrg/xdg/CODE_OF_CONDUCT.md
new file mode 100644
index 000000000..75349e53e
--- /dev/null
+++ b/vendor/github.com/adrg/xdg/CODE_OF_CONDUCT.md
@@ -0,0 +1,77 @@
+# Contributor Covenant Code of Conduct
+
+## Our Pledge
+
+In the interest of fostering an open and welcoming environment, we as
+contributors and maintainers pledge to making participation in our project and
+our community a harassment-free experience for everyone, regardless of age,
+body size, disability, ethnicity, sex characteristics, gender identity and
+expression, level of experience, education, socio-economic status, nationality,
+personal appearance, race, religion, or sexual identity and orientation.
+
+## Our Standards
+
+Examples of behaviour that contributes to creating a positive environment
+include:
+
+* Using welcoming and inclusive language
+* Being respectful of differing viewpoints and experiences
+* Gracefully accepting constructive criticism
+* Focusing on what is best for the community
+* Showing empathy towards other community members
+
+Examples of unacceptable behaviour by participants include:
+
+* The use of sexualized language or imagery and unwelcome sexual attention or
+ advances
+* Trolling, insulting/derogatory comments, and personal or political attacks
+* Public or private harassment
+* Publishing others' private information, such as a physical or electronic
+ address, without explicit permission
+* Other conduct which could reasonably be considered inappropriate in a
+ professional setting
+
+## Our Responsibilities
+
+Project maintainers are responsible for clarifying the standards of acceptable
+behaviour and are expected to take appropriate and fair corrective action in
+response to any instances of unacceptable behaviour.
+
+Project maintainers have the right and responsibility to remove, edit, or
+reject comments, commits, code, wiki edits, issues, and other contributions
+that are not aligned to this Code of Conduct, or to ban temporarily or
+permanently any contributor for other behaviour that they deem inappropriate,
+threatening, offensive, or harmful.
+
+## Scope
+
+This Code of Conduct applies both within project spaces and in public spaces
+when an individual is representing the project or its community. Examples of
+representing a project or community include using an official project e-mail
+address, posting via an official social media account, or acting as an appointed
+representative at an online or offline event. Representation of a project may be
+further defined and clarified by project maintainers.
+
+## Enforcement
+
+Instances of abusive, harassing, or otherwise unacceptable behaviour may be
+reported by contacting the project team at adrg@epistack.com. All complaints
+will be reviewed and investigated and will result in a response that is deemed
+necessary and appropriate to the circumstances. The project team is obligated to
+maintain confidentiality with regard to the reporter of an incident.
+Further details of specific enforcement policies may be posted separately.
+
+Project maintainers who do not follow or enforce the Code of Conduct in good
+faith may face temporary or permanent repercussions as determined by other
+members of the project's leadership.
+
+## Attribution
+
+This Code of Conduct is adapted from the [Contributor Covenant][homepage],
+version 1.4, available at
+https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
+
+[homepage]: https://www.contributor-co