Repository: jesseduffield/lazygit (language: go)

Issue:
Config and/or state files in read-only file systems cause crashes and prevent logging.
**Describe the bug**
Lazygit crashes after prompting for making a repo, before entering the TUI, if it cannot write to`$XDG_CONFIG_HOME/lazygit/state.yml` and it is not possible to log the issue using `lazy --debug` if `$XDG_CONFIG_HOME/lazygit/development.log` is also not able to be written to.
Both of those are inevitable to happen if the lazygit config folder is in a read-only file system.

**To Reproduce**
This is not the only way it can happen but it is how I specifically encountered the issue.
Steps to reproduce the an instance of the behavior:

0. Install [home-manager](https://github.com/nix-community/home-manager), back up your lazygit config folder and run `home-manager init`.
1. Open `$HOME/.config/home-manager/home.nix` with a text editor.
2. Add `home.file.".config/lazygit/config.yml".text = "";` inside it's configuration.
3. Run `home-manager switch`
4. Run `lazygit` inside a git repository

**Expected behavior**
For program state files to respect `$XDG_STATE_HOME` as mentioned in #2794 with the expected default of `$HOME/.local/state`.
The XDG Base Directory Specification can be found [here](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html)

**Version info:**
This issue happens in the current lazygit nix package for nix stable 23.05 (which is lazygit 0.38.2) and on a build from the current latest commit of this repository [b92c294](https://github.com/jesseduffield/lazygit/commit/b92c29405930458dbaa6dbe242eb4576e3d462f2).
I have prepended the output of the `lazygit --version` command to the stderr output of lazygit of both builds.

**Stderr Output:**
`commit=, build date=, build source=nix, version=0.38.2, os=linux, arch=amd64, git version=2.40.1`
```
2023/07/31 21:16:03 An error occurred! Please create an issue at: https://github.com/jesseduffield/lazygit/issues

*fs.PathError open /home/u/.config/lazygit/state.yml: read-only file system
github.com/jesseduffield/lazygit/pkg/app/app.go:54 (0xab73dc)
github.com/jesseduffield/lazygit/pkg/app/entry_point.go:146 (0xab92da)
github.com/jesseduffield/lazygit/main.go:23 (0xabaebe)
runtime/internal/atomic/types.go:194 (0x439767)
runtime/asm_amd64.s:1598 (0x469b01)
```

`commit=, build date=, build source=unknown, version=unversioned, os=linux, arch=amd64, git version=2.40.1`
```
2023/07/31 21:31:33 An error occurred! Please create an issue at: https://github.com/jesseduffield/lazygit/issues

*fs.PathError open /home/u/.config/lazygit/state.yml: read-only file system
/home/u/go/pkg/mod/github.com/jesseduffield/lazygit@v0.39.4/pkg/app/app.go:55 (0xad7e9c)
	Run: newErr := errors.Wrap(err, 0)
/home/u/go/pkg/mod/github.com/jesseduffield/lazygit@v0.39.4/pkg/app/entry_point.go:151 (0xad9fa6)
	Start: Run(appConfig, common, appTypes.NewStartArgs(cliArgs.FilterPath, parsedGitArg, integrationTest))
/home/u/go/pkg/mod/github.com/jesseduffield/lazygit@v0.39.4/main.go:23 (0xadb85e)
	main: app.Start(ldFlagsBuildInfo, nil)
/nix/store/fp9k417pvah7d6ibbnz2x2llzframbk4-go-1.20.6/share/go/src/runtime/internal/atomic/types.go:194 (0x439767)
	(*Uint32).Load: return Load(&u.value)
/nix/store/fp9k417pvah7d6ibbnz2x2llzframbk4-go-1.20.6/share/go/src/runtime/asm_amd64.s:1598 (0x469b01)
	goexit: BYTE	$0x90	// NOP
```


Discussion / hints:
Similar to #818 with same changes necessary for resolution.
I can't reproduce this with a read-only config folder (i.e. `chmod 555 "~/Library/Application Support/lazygit"` on Mac). Lazygit starts normally, and displays the "Thanks for using lazygit" message every time, because it can't record that it did so in `state.yml`. It seems that you really need a read-only file system to trigger the crash, but I'm too lazy to set one up to try that.

There's [code in app_config.go](https://github.com/jesseduffield/lazygit/blob/master/pkg/config/app_config.go#L276) that checks for permission errors when writing the state file and silently ignores those. My guess is that the `os.IsPermission` function doesn't check for `EROFS`, so we might consider including that check ourselves at that point.

Fix patch:
diff --git a/docs/Config.md b/docs/Config.md
index b5c854d297d..5b686fc1978 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 64ecc4c6d26..329e0f0e884 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 733c1c2680c..414385b546c 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 ec539a7573e..67852dcd19f 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 602b812f354..00000000000
--- 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 2a4648d4fc9..00000000000
--- 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 74ee71dbac9..00000000000
--- 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 807e489a293..00000000000
--- 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 bb81060b60a..00000000000
--- 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 ea99f2fd080..00000000000
--- 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 6711ff967e2..00000000000
--- 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 3746dea65cb..00000000000
--- 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 183174b74fb..00000000000
--- 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 00000000000..75349e53ee7
--- /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-covenant.org
+
+For answers to common questions about this code of conduct, see
+https://www.contributor-covenant.org/faq
diff --git a/vendor/github.com/adrg/xdg/CONTRIBUTING.md b/vendor/github.com/adrg/xdg/CONTRIBUTING.md
new file mode 100644
index 00000000000..006f146b38f
--- /dev/null
+++ b/vendor/github.com/adrg/xdg/CONTRIBUTING.md
@@ -0,0 +1,135 @@
+# Contributing to this project
+
+Contributions in the form of pull requests, issues or just general feedback,
+are always welcome. Please take a moment to review this document in order to
+make the contribution process easy and effective for everyone involved.
+
+Following these guidelines helps to communicate that you respect the time of
+the developers managing and developing this open source project. In return,
+they should reciprocate that respect in addressing your issue or assessing
+patches and features.
+
+## Using the issue tracker
+
+The issue tracker is the preferred channel for [bug reports](#bugs),
+[features requests](#features) and [submitting pull
+requests](#pull-requests), but please respect the following restrictions:
+
+* Please **do not** use the issue tracker for personal support requests (use
+  [Stack Overflow](http://stackoverflow.com) or IRC).
+* Please **do not** derail or troll issues. Keep the discussion on topic and
+  respect the opinions of others.
+
+<a name="bugs"></a>
+## Bug reports
+
+A bug is a _demonstrable problem_ that is caused by the code in the repository.
+Good bug reports are extremely helpful - thank you!
+
+Guidelines for bug reports:
+
+1. **Use the GitHub issue search** &mdash; check if the issue has already been
+   reported.
+2. **Check if the issue has been fixed** &mdash; try to reproduce it using the
+   latest `master` or development branch in the repository.
+3. **Isolate the problem** &mdash; create a reduced test case.
+
+A good bug report shouldn't leave others needing to chase you up for more
+information. Please try to be as detailed as possible in your report. What is
+your environment? What steps will reproduce the issue? What browser(s) and OS
+experience the problem? What would you expect to be the outcome? All these
+details will help people to fix any potential bugs.
+
+Example:
+
+> Short and descriptive example bug report title
+>
+> A summary of the issue and the browser/OS environment in which it occurs. If
+> suitable, include the steps required to reproduce the bug.
+>
+> 1. This is the first step
+> 2. This is the second step
+> 3. Further steps, etc.
+>
+> `<url>` - a link to the reduced test case
+>
+> Any other information you want to share that is relevant to the issue being
+> reported. This might include the lines of code that you have identified as
+> causing the bug, and potential solutions (and your opinions on their
+> merits).
+
+
+<a name="features"></a>
+## Feature requests
+
+Feature requests are welcome. But take a moment to find out whether your idea
+fits with the scope and aims of the project. It's up to *you* to make a strong
+case to convince the project's developers of the merits of this feature. Please
+provide as much detail and context as possible.
+
+
+<a name="pull-requests"></a>
+## Pull requests
+
+Good pull requests - patches, improvements, new features - are a fantastic
+help. They should remain focused in scope and avoid containing unrelated
+commits.
+
+**Please ask first** before embarking on any significant pull request (e.g.
+implementing features, refactoring code, porting to a different language),
+otherwise you risk spending a lot of time working on something that the
+project's developers might not want to merge into the project.
+
+Please adhere to the coding conventions used throughout a project (indentation,
+accurate comments, etc.) and any other requirements (such as test coverage).
+
+Follow this process if you'd like your work considered for inclusion in the
+project:
+
+1. [Fork](http://help.github.com/fork-a-repo/) the project, clone your fork,
+   and configure the remotes:
+
+   ```bash
+   # Clone your fork of the repo into the current directory
+   git clone https://github.com/<your-username>/<repo-name>
+   # Navigate to the newly cloned directory
+   cd <repo-name>
+   # Assign the original repo to a remote called "upstream"
+   git remote add upstream https://github.com/<upstream-owner>/<repo-name>
+   ```
+
+2. If you cloned a while ago, get the latest changes from upstream:
+
+   ```bash
+   git checkout <dev-branch>
+   git pull upstream <dev-branch>
+   ```
+
+3. Create a new topic branch (off the main project development branch) to
+   contain your feature, change, or fix:
+
+   ```bash
+   git checkout -b <topic-branch-name>
+   ```
+
+4. Commit your changes in logical chunks and use descriptive commit messages.
+   Use [interactive rebase](https://help.github.com/articles/interactive-rebase)
+   to tidy up your commits before making them public.
+
+5. Locally merge (or rebase) the upstream development branch into your topic branch:
+
+   ```bash
+   git pull [--rebase] upstream <dev-branch>
+   ```
+
+6. Push your topic branch up to your fork:
+
+   ```bash
+   git push origin <topic-branch-name>
+   ```
+
+7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/)
+    with a clear title and description.
+
+**IMPORTANT**: By submitting a patch, you agree to allow the project owner to
+license your work under the same license as that used by the project.
diff --git a/vendor/github.com/adrg/xdg/LICENSE b/vendor/github.com/adrg/xdg/LICENSE
new file mode 100644
index 00000000000..7307e1b7c89
--- /dev/null
+++ b/vendor/github.com/adrg/xdg/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2014 Adrian-George Bostan <adrg@epistack.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/vendor/github.com/adrg/xdg/README.md b/vendor/github.com/adrg/xdg/README.md
new file mode 100644
index 00000000000..b55403c27c0
--- /dev/null
+++ b/vendor/github.com/adrg/xdg/README.md
@@ -0,0 +1,280 @@
+<h1 align="center">
+  <div>
+    <img src="https://raw.githubusercontent.com/adrg/adrg.github.io/master/assets/projects/xdg/logo.svg" alt="xdg logo"/>
+  </div>
+</h1>
+
+<h4 align="center">Go implementation of the XDG Base Directory Specification and XDG user directories.</h4>
+
+<p align="center">
+    <a href="https://github.com/adrg/xdg/actions?query=workflow%3ACI">
+        <img alt="Build status" src="https://github.com/adrg/xdg/workflows/CI/badge.svg">
+    </a>
+    <a href="https://app.codecov.io/gh/adrg/xdg">
+        <img alt="Code coverage" src="https://codecov.io/gh/adrg/xdg/branch/master/graphs/badge.svg?branch=master">
+    </a>
+    <a href="https://pkg.go.dev/github.com/adrg/xdg">
+        <img alt="pkg.go.dev documentation" src="https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white">
+    </a>
+    <a href="https://opensource.org/licenses/MIT" rel="nofollow">
+        <img alt="MIT license" src="https://img.shields.io/github/license/adrg/xdg">
+    </a>
+    <br />
+    <a href="https://goreportcard.com/report/github.com/adrg/xdg">
+        <img alt="Go report card" src="https://goreportcard.com/badge/github.com/adrg/xdg">
+    </a>
+    <a href="https://github.com/avelino/awesome-go#configuration">
+        <img alt="Awesome Go" src="https://awesome.re/mentioned-badge.svg">
+    </a>
+    <a href="https://github.com/adrg/xdg/graphs/contributors">
+        <img alt="GitHub contributors" src="https://img.shields.io/github/contributors/adrg/xdg" />
+    </a>
+    <a href="https://github.com/adrg/xdg/issues">
+        <img alt="GitHub open issues" src="https://img.shields.io/github/issues-raw/adrg/xdg">
+    </a>
+    <a href="https://ko-fi.com/T6T72WATK">
+        <img alt="Buy me a coffee" src="https://img.shields.io/static/v1.svg?label=%20&message=Buy%20me%20a%20coffee&color=579fbf&logo=buy%20me%20a%20coffee&logoColor=white">
+    </a>
+</p>
+
+Provides an implementation of the [XDG Base Directory Specification](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html).
+The specification defines a set of standard paths for storing application files,
+including data and configuration files. For portability and flexibility reasons,
+applications should use the XDG defined locations instead of hardcoding paths.
+The package also includes the locations of well known [user directories](https://wiki.archlinux.org/index.php/XDG_user_directories), as well as
+other common directories such as fonts and applications.
+
+The current implementation supports **most flavors of Unix**, **Windows**, **macOS** and **Plan 9**.  
+On Windows, where XDG environment variables are not usually set, the package uses [Known Folders](https://docs.microsoft.com/en-us/windows/win32/shell/known-folders)
+as defaults. Therefore, appropriate locations are used for common [folders](https://docs.microsoft.com/en-us/windows/win32/shell/knownfolderid) which may have been redirected.
+
+See usage [examples](#usage) below. Full documentation can be found at https://pkg.go.dev/github.com/adrg/xdg.
+
+## Installation
+    go get github.com/adrg/xdg
+
+## Default locations
+
+The package defines sensible defaults for XDG variables which are empty or not
+present in the environment.
+
+- On Unix-like operating systems, XDG environment variables are tipically defined.
+Appropriate default locations are used for the environment variables which are not set.
+- On Windows, XDG environment variables are usually not set. If that is the case,
+the package relies on the appropriate [Known Folders](https://docs.microsoft.com/en-us/windows/win32/shell/knownfolderid).
+Sensible fallback locations are used for the folders which are not set.
+
+### XDG Base Directory
+
+<details open>
+    <summary><strong>Unix-like operating systems</strong></summary>
+    <br/>
+
+| <a href="#xdg-base-directory"><img width="400" height="0"></a> | <a href="#xdg-base-directory"><img width="500" height="0"></a><p>Unix</p> | <a href="#xdg-base-directory"><img width="600" height="0"></a><p>macOS</p>                                            | <a href="#xdg-base-directory"><img width="500" height="0"></a><p>Plan 9</p> |
+| :------------------------------------------------------------: | :-----------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------: |
+| <kbd><b>XDG_DATA_HOME</b></kbd>                                | <kbd>~/.local/share</kbd>                                                 | <kbd>~/Library/Application&nbsp;Support</kbd>                                                                         | <kbd>$home/lib</kbd>                                                        |
+| <kbd><b>XDG_DATA_DIRS</b></kbd>                                | <kbd>/usr/local/share</kbd><br/><kbd>/usr/share</kbd>                     | <kbd>/Library/Application&nbsp;Support</kbd>                                                                          | <kbd>/lib</kbd>                                                             |
+| <kbd><b>XDG_CONFIG_HOME</b></kbd>                              | <kbd>~/.config</kbd>                                                      | <kbd>~/Library/Application&nbsp;Support</kbd>                                                                         | <kbd>$home/lib</kbd>                                                        |
+| <kbd><b>XDG_CONFIG_DIRS</b></kbd>                              | <kbd>/etc/xdg</kbd>                                                       | <kbd>~/Library/Preferences</kbd><br/><kbd>/Library/Application&nbsp;Support</kbd><br/><kbd>/Library/Preferences</kbd> | <kbd>/lib</kbd>                                                             |
+| <kbd><b>XDG_STATE_HOME</b></kbd>                               | <kbd>~/.local/state</kbd>                                                 | <kbd>~/Library/Application&nbsp;Support</kbd>                                                                         | <kbd>$home/lib/state</kbd>                                                  |
+| <kbd><b>XDG_CACHE_HOME</b></kbd>                               | <kbd>~/.cache</kbd>                                                       | <kbd>~/Library/Caches</kbd>                                                                                           | <kbd>$home/lib/cache</kbd>                                                  |
+| <kbd><b>XDG_RUNTIME_DIR</b></kbd>                              | <kbd>/run/user/UID</kbd>                                                  | <kbd>~/Library/Application&nbsp;Support</kbd>                                                                         | <kbd>/tmp</kbd>                                                             |
+
+</details>
+
+<details open>
+    <summary><strong>Microsoft Windows</strong></summary>
+    <br/>
+
+| <a href="#xdg-base-directory"><img width="400" height="0"></a> | <a href="#xdg-base-directory"><img width="700" height="0"></a><p>Known&nbsp;Folder(s)</p> | <a href="#xdg-base-directory"><img width="900" height="0"></a><p>Fallback(s)</p> |
+| :------------------------------------------------------------: | :---------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------: |
+| <kbd><b>XDG_DATA_HOME</b></kbd>                                | <kbd>LocalAppData</kbd>                                                                   | <kbd>%LOCALAPPDATA%</kbd>                                                        |
+| <kbd><b>XDG_DATA_DIRS</b></kbd>                                | <kbd>RoamingAppData</kbd><br/><kbd>ProgramData</kbd>                                      | <kbd>%APPADATA%</kbd><br/><kbd>%ProgramData%</kbd>                               |
+| <kbd><b>XDG_CONFIG_HOME</b></kbd>                              | <kbd>LocalAppData</kbd>                                                                   | <kbd>%LOCALAPPDATA%</kbd>                                                        |
+| <kbd><b>XDG_CONFIG_DIRS</b></kbd>                              | <kbd>ProgramData</kbd><br/><kbd>RoamingAppData</kbd>                                      | <kbd>%ProgramData%</kbd><br/><kbd>%APPDATA%</kbd>                                |
+| <kbd><b>XDG_STATE_HOME</b></kbd>                               | <kbd>LocalAppData</kbd>                                                                   | <kbd>%LOCALAPPDATA%</kbd>                                                        |
+| <kbd><b>XDG_CACHE_HOME</b></kbd>                               | <kbd>LocalAppData\cache</kbd>                                                             | <kbd>%LOCALAPPDATA%\cache</kbd>                                                  |
+| <kbd><b>XDG_RUNTIME_DIR</b></kbd>                              | <kbd>LocalAppData</kbd>                                                                   | <kbd>%LOCALAPPDATA%</kbd>                                                        |
+
+</details>
+
+### XDG user directories
+
+<details open>
+    <summary><strong>Unix-like operating systems</strong></summary>
+    <br/>
+
+| <a href="#xdg-user-directories"><img width="500" height="0"></a> | <a href="#xdg-user-directories"><img width="500" height="0"></a><p>Unix</p> | <a href="#xdg-user-directories"><img width="500" height="0"></a><p>macOS</p>  | <a href="#xdg-user-directories"><img width="500" height="0"></a><p>Plan 9</p> |
+| :--------------------------------------------------------------: | :-------------------------------------------------------------------------: | :---------------------------------------------------------------------------: | :---------------------------------------------------------------------------: |
+| <kbd><b>XDG_DESKTOP_DIR</b></kbd>                                | <kbd>~/Desktop</kbd>                                                        | <kbd>~/Desktop</kbd>                                                          | <kbd>$home/desktop</kbd>                                                      |
+| <kbd><b>XDG_DOWNLOAD_DIR</b></kbd>                               | <kbd>~/Downloads</kbd>                                                      | <kbd>~/Downloads</kbd>                                                        | <kbd>$home/downloads</kbd>                                                    |
+| <kbd><b>XDG_DOCUMENTS_DIR</b></kbd>                              | <kbd>~/Documents</kbd>                                                      | <kbd>~/Documents</kbd>                                                        | <kbd>$home/documents</kbd>                                                    |
+| <kbd><b>XDG_MUSIC_DIR</b></kbd>                                  | <kbd>~/Music</kbd>                                                          | <kbd>~/Music</kbd>                                                            | <kbd>$home/music</kbd>                                                        |
+| <kbd><b>XDG_PICTURES_DIR</b></kbd>                               | <kbd>~/Pictures</kbd>                                                       | <kbd>~/Pictures</kbd>                                                         | <kbd>$home/pictures</kbd>                                                     |
+| <kbd><b>XDG_VIDEOS_DIR</b></kbd>                                 | <kbd>~/Videos</kbd>                                                         | <kbd>~/Movies</kbd>                                                           | <kbd>$home/videos</kbd>                                                       |
+| <kbd><b>XDG_TEMPLATES_DIR</b></kbd>                              | <kbd>~/Templates</kbd>                                                      | <kbd>~/Templates</kbd>                                                        | <kbd>$home/templates</kbd>                                                    |
+| <kbd><b>XDG_PUBLICSHARE_DIR</b></kbd>                            | <kbd>~/Public</kbd>                                                         | <kbd>~/Public</kbd>                                                           | <kbd>$home/public</kbd>                                                       |
+
+</details>
+
+<details open>
+    <summary><strong>Microsoft Windows</strong></summary>
+    <br/>
+
+| <a href="#xdg-user-directories"><img width="500" height="0"></a> | <a href="#xdg-user-directories"><img width="600" height="0"></a><p>Known&nbsp;Folder(s)</p> | <a href="#xdg-user-directories"><img width="900" height="0"></a><p>Fallback(s)</p> |
+| :--------------------------------------------------------------: | :-----------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------: |
+| <kbd><b>XDG_DESKTOP_DIR</b></kbd>                                | <kbd>Desktop</kbd>                                                                          | <kbd>%USERPROFILE%\Desktop</kbd>                                                   |
+| <kbd><b>XDG_DOWNLOAD_DIR</b></kbd>                               | <kbd>Downloads</kbd>                                                                        | <kbd>%USERPROFILE%\Downloads</kbd>                                                 |
+| <kbd><b>XDG_DOCUMENTS_DIR</b></kbd>                              | <kbd>Documents</kbd>                                                                        | <kbd>%USERPROFILE%\Documents</kbd>                                                 |
+| <kbd><b>XDG_MUSIC_DIR</b></kbd>                                  | <kbd>Music</kbd>                                                                            | <kbd>%USERPROFILE%\Music</kbd>                                                     |
+| <kbd><b>XDG_PICTURES_DIR</b></kbd>                               | <kbd>Pictures</kbd>                                                                         | <kbd>%USERPROFILE%\Pictures</kbd>                                                  |
+| <kbd><b>XDG_VIDEOS_DIR</b></kbd>                                 | <kbd>Videos</kbd>                                                                           | <kbd>%USERPROFILE%\Videos</kbd>                                                    |
+| <kbd><b>XDG_TEMPLATES_DIR</b></kbd>                              | <kbd>Templates</kbd>                                                                        | <kbd>%APPDATA%\Microsoft\Windows\Templates</kbd>                                   |
+| <kbd><b>XDG_PUBLICSHARE_DIR</b></kbd>                            | <kbd>Public</kbd>                                                                           | <kbd>%PUBLIC%</kbd>                                                                |
+
+</details>
+
+### Other directories
+
+<details open>
+    <summary><strong>Unix-like operating systems</strong></summary>
+    <br/>
+
+| <a href="#other-directories"><img width="400" height="0"></a> | <a href="#other-directories"><img width="600" height="0"></a><p>Unix</p>                                                                                                                                         | <a href="#other-directories"><img width="600" height="0"></a><p>macOS</p>                                                           | <a href="#other-directories"><img width="400" height="0"></a><p>Plan 9</p> |
+| :-----------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------: |
+| <kbd><b>Home</b></kbd>                                        | <kbd>$HOME</kbd>                                                                                                                                                                                                 | <kbd>$HOME</kbd>                                                                                                                    | <kbd>$home</kbd>                                                           |
+| <kbd><b>Applications</b></kbd>                                | <kbd>$XDG_DATA_HOME/applications</kbd><br/><kbd>~/.local/share/applications</kbd><br/><kbd>/usr/local/share/applications</kbd><br/><kbd>/usr/share/applications</kbd><br/><kbd>$XDG_DATA_DIRS/applications</kbd> | <kbd>/Applications</kbd>                                                                                                            | <kbd>$home/bin</kbd><br/><kbd>/bin</kbd>                                   |
+| <kbd><b>Fonts</b></kbd>                                       | <kbd>$XDG_DATA_HOME/fonts</kbd><br/><kbd>&#126;/.fonts</kbd><br/><kbd>~/.local/share/fonts</kbd><br/><kbd>/usr/local/share/fonts</kbd><br/><kbd>/usr/share/fonts</kbd><br/><kbd>$XDG_DATA_DIRS/fonts</kbd>       | <kbd>~/Library/Fonts</kbd><br/><kbd>/Library/Fonts</kbd><br/><kbd>/System/Library/Fonts</kbd><br/><kbd>/Network/Library/Fonts</kbd> | <kbd>$home/lib/font</kbd><br/><kbd>/lib/font</kbd>                         |
+
+</details>
+
+<details open>
+    <summary><strong>Microsoft Windows</strong></summary>
+    <br/>
+
+| <a href="#other-directories"><img width="400" height="0"></a> | <a href="#other-directories"><img width="300" height="0"></a><p>Known&nbsp;Folder(s)</p> | <a href="#other-directories"><img width="1300" height="0"></a><p>Fallback(s)</p>                                                        |
+| :-----------------------------------------------------------: | :--------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------: |
+| <kbd><b>Home</b></kbd>                                        | <kbd>Profile</kbd>                                                                       | <kbd>%USERPROFILE%</kbd>                                                                                                                |
+| <kbd><b>Applications</b></kbd>                                | <kbd>Programs</kbd><br/><kbd>CommonPrograms</kbd>                                        | <kbd>%APPDATA%\Microsoft\Windows\Start&nbsp;Menu\Programs</kbd><br/><kbd>%ProgramData%\Microsoft\Windows\Start&nbsp;Menu\Programs</kbd> |
+| <kbd><b>Fonts</b></kbd>                                       | <kbd>Fonts</kbd><br/><kbd>-</kbd>                                                        | <kbd>%SystemRoot%\Fonts</kbd><br/><kbd>%LOCALAPPDATA%\Microsoft\Windows\Fonts</kbd>                                                     |
+
+</details>
+
+## Usage
+
+#### XDG Base Directory
+
+```go
+package main
+
+import (
+	"log"
+
+	"github.com/adrg/xdg"
+)
+
+func main() {
+	// XDG Base Directory paths.
+	log.Println("Home data directory:", xdg.DataHome)
+	log.Println("Data directories:", xdg.DataDirs)
+	log.Println("Home config directory:", xdg.ConfigHome)
+	log.Println("Config directories:", xdg.ConfigDirs)
+	log.Println("Home state directory:", xdg.StateHome)
+	log.Println("Cache directory:", xdg.CacheHome)
+	log.Println("Runtime directory:", xdg.RuntimeDir)
+
+	// Other common directories.
+	log.Println("Home directory:", xdg.Home)
+	log.Println("Application directories:", xdg.ApplicationDirs)
+	log.Println("Font directories:", xdg.FontDirs)
+
+	// Obtain a suitable location for application config files.
+	// ConfigFile takes one parameter which must contain the name of the file,
+	// but it can also contain a set of parent directories. If the directories
+	// don't exist, they will be created relative to the base config directory.
+	configFilePath, err := xdg.ConfigFile("appname/config.yaml")
+	if err != nil {
+		log.Fatal(err)
+	}
+	log.Println("Save the config file at:", configFilePath)
+
+	// For other types of application files use:
+	// xdg.DataFile()
+	// xdg.StateFile()
+	// xdg.CacheFile()
+	// xdg.RuntimeFile()
+
+	// Finding application config files.
+	// SearchConfigFile takes one parameter which must contain the name of
+	// the file, but it can also contain a set of parent directories relative
+	// to the config search paths (xdg.ConfigHome and xdg.ConfigDirs).
+	configFilePath, err = xdg.SearchConfigFile("appname/config.yaml")
+	if err != nil {
+		log.Fatal(err)
+	}
+	log.Println("Config file was found at:", configFilePath)
+
+	// For other types of application files use:
+	// xdg.SearchDataFile()
+	// xdg.SearchStateFile()
+	// xdg.SearchCacheFile()
+	// xdg.SearchRuntimeFile()
+}
+```
+
+#### XDG user directories
+
+```go
+package main
+
+import (
+	"log"
+
+	"github.com/adrg/xdg"
+)
+
+func main() {
+	// XDG user directories.
+	log.Println("Desktop directory:", xdg.UserDirs.Desktop)
+	log.Println("Download directory:", xdg.UserDirs.Download)
+	log.Println("Documents directory:", xdg.UserDirs.Documents)
+	log.Println("Music directory:", xdg.UserDirs.Music)
+	log.Println("Pictures directory:", xdg.UserDirs.Pictures)
+	log.Println("Videos directory:", xdg.UserDirs.Videos)
+	log.Println("Templates directory:", xdg.UserDirs.Templates)
+	log.Println("Public directory:", xdg.UserDirs.PublicShare)
+}
+```
+
+## Stargazers over time
+
+[![Stargazers over time](https://starchart.cc/adrg/xdg.svg)](https://starchart.cc/adrg/xdg)
+
+## Contributing
+
+Contributions in the form of pull requests, issues or just general feedback,
+are always welcome.  
+See [CONTRIBUTING.MD](CONTRIBUTING.md).
+
+**Contributors**:
+[adrg](https://github.com/adrg),
+[wichert](https://github.com/wichert),
+[bouncepaw](https://github.com/bouncepaw),
+[gabriel-vasile](https://github.com/gabriel-vasile),
+[KalleDK](https://github.com/KalleDK),
+[nvkv](https://github.com/nvkv),
+[djdv](https://github.com/djdv).
+
+## References
+
+For more information see:
+* [XDG Base Directory Specification](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html)
+* [XDG user directories](https://wiki.archlinux.org/index.php/XDG_user_directories)
+* [Windows Known Folders](https://docs.microsoft.com/en-us/windows/win32/shell/knownfolderid)
+
+## License
+
+Copyright (c) 2014 Adrian-George Bostan.
+
+This project is licensed under the [MIT license](https://opensource.org/licenses/MIT).
+See [LICENSE](LICENSE) for more details.
diff --git a/vendor/github.com/adrg/xdg/base_dirs.go b/vendor/github.com/adrg/xdg/base_dirs.go
new file mode 100644
index 00000000000..a8a3fd55cca
--- /dev/null
+++ b/vendor/github.com/adrg/xdg/base_dirs.go
@@ -0,0 +1,68 @@
+package xdg
+
+import "github.com/adrg/xdg/internal/pathutil"
+
+// XDG Base Directory environment variables.
+const (
+	envDataHome   = "XDG_DATA_HOME"
+	envDataDirs   = "XDG_DATA_DIRS"
+	envConfigHome = "XDG_CONFIG_HOME"
+	envConfigDirs = "XDG_CONFIG_DIRS"
+	envStateHome  = "XDG_STATE_HOME"
+	envCacheHome  = "XDG_CACHE_HOME"
+	envRuntimeDir = "XDG_RUNTIME_DIR"
+)
+
+type baseDirectories struct {
+	dataHome   string
+	data       []string
+	configHome string
+	config     []string
+	stateHome  string
+	cacheHome  string
+	runtime    string
+
+	// Non-standard directories.
+	fonts        []string
+	applications []string
+}
+
+func (bd baseDirectories) dataFile(relPath string) (string, error) {
+	return pathutil.Create(relPath, append([]string{bd.dataHome}, bd.data...))
+}
+
+func (bd baseDirectories) configFile(relPath string) (string, error) {
+	return pathutil.Create(relPath, append([]string{bd.configHome}, bd.config...))
+}
+
+func (bd baseDirectories) stateFile(relPath string) (string, error) {
+	return pathutil.Create(relPath, []string{bd.stateHome})
+}
+
+func (bd baseDirectories) cacheFile(relPath string) (string, error) {
+	return pathutil.Create(relPath, []string{bd.cacheHome})
+}
+
+func (bd baseDirectories) runtimeFile(relPath string) (string, error) {
+	return pathutil.Create(relPath, []string{bd.runtime})
+}
+
+func (bd baseDirectories) searchDataFile(relPath string) (string, error) {
+	return pathutil.Search(relPath, append([]string{bd.dataHome}, bd.data...))
+}
+
+func (bd baseDirectories) searchConfigFile(relPath string) (string, error) {
+	return pathutil.Search(relPath, append([]string{bd.configHome}, bd.config...))
+}
+
+func (bd baseDirectories) searchStateFile(relPath string) (string, error) {
+	return pathutil.Search(relPath, []string{bd.stateHome})
+}
+
+func (bd baseDirectories) searchCacheFile(relPath string) (string, error) {
+	return pathutil.Search(relPath, []string{bd.cacheHome})
+}
+
+func (bd baseDirectories) searchRuntimeFile(relPath string) (string, error) {
+	return pathutil.Search(relPath, []string{bd.runtime})
+}
diff --git a/vendor/github.com/adrg/xdg/codecov.yml b/vendor/github.com/adrg/xdg/codecov.yml
new file mode 100644
index 00000000000..54ee338fd70
--- /dev/null
+++ b/vendor/github.com/adrg/xdg/codecov.yml
@@ -0,0 +1,11 @@
+coverage:
+  status:
+    project:
+      default:
+        target: 90%
+        threshold: 1%
+    patch:
+      default:
+        target: 100%
+ignore:
+  - "paths_plan9.go"
diff --git a/vendor/github.com/adrg/xdg/doc.go b/vendor/github.com/adrg/xdg/doc.go
new file mode 100644
index 00000000000..7747b183e44
--- /dev/null
+++ b/vendor/github.com/adrg/xdg/doc.go
@@ -0,0 +1,99 @@
+/*
+Package xdg provides an implementation of the XDG Base Directory Specification.
+The specification defines a set of standard paths for storing application files
+including data and configuration files. For portability and flexibility reasons,
+applications should use the XDG defined locations instead of hardcoding paths.
+The package also includes the locations of well known user directories.
+
+The current implementation supports most flavors of Unix, Windows, Mac OS and Plan 9.
+
+	For more information regarding the XDG Base Directory Specification see:
+	https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
+
+	For more information regarding the XDG user directories see:
+	https://wiki.archlinux.org/index.php/XDG_user_directories
+
+	For more information regarding the Windows Known Folders see:
+	https://docs.microsoft.com/en-us/windows/win32/shell/known-folders
+
+Usage
+
+XDG Base Directory
+	package main
+
+	import (
+		"log"
+
+		"github.com/adrg/xdg"
+	)
+
+	func main() {
+		// XDG Base Directory paths.
+		log.Println("Home data directory:", xdg.DataHome)
+		log.Println("Data directories:", xdg.DataDirs)
+		log.Println("Home config directory:", xdg.ConfigHome)
+		log.Println("Config directories:", xdg.ConfigDirs)
+		log.Println("Home state directory:", xdg.StateHome)
+		log.Println("Cache directory:", xdg.CacheHome)
+		log.Println("Runtime directory:", xdg.RuntimeDir)
+
+		// Other common directories.
+		log.Println("Home directory:", xdg.Home)
+		log.Println("Application directories:", xdg.ApplicationDirs)
+		log.Println("Font directories:", xdg.FontDirs)
+
+		// Obtain a suitable location for application config files.
+		// ConfigFile takes one parameter which must contain the name of the file,
+		// but it can also contain a set of parent directories. If the directories
+		// don't exist, they will be created relative to the base config directory.
+		configFilePath, err := xdg.ConfigFile("appname/config.yaml")
+		if err != nil {
+			log.Fatal(err)
+		}
+		log.Println("Save the config file at:", configFilePath)
+
+		// For other types of application files use:
+		// xdg.DataFile()
+		// xdg.StateFile()
+		// xdg.CacheFile()
+		// xdg.RuntimeFile()
+
+		// Finding application config files.
+		// SearchConfigFile takes one parameter which must contain the name of
+		// the file, but it can also contain a set of parent directories relative
+		// to the config search paths (xdg.ConfigHome and xdg.ConfigDirs).
+		configFilePath, err = xdg.SearchConfigFile("appname/config.yaml")
+		if err != nil {
+			log.Fatal(err)
+		}
+		log.Println("Config file was found at:", configFilePath)
+
+		// For other types of application files use:
+		// xdg.SearchDataFile()
+		// xdg.SearchStateFile()
+		// xdg.SearchCacheFile()
+		// xdg.SearchRuntimeFile()
+	}
+
+XDG user directories
+	package main
+
+	import (
+		"log"
+
+		"github.com/adrg/xdg"
+	)
+
+	func main() {
+		// XDG user directories.
+		log.Println("Desktop directory:", xdg.UserDirs.Desktop)
+		log.Println("Download directory:", xdg.UserDirs.Download)
+		log.Println("Documents directory:", xdg.UserDirs.Documents)
+		log.Println("Music directory:", xdg.UserDirs.Music)
+		log.Println("Pictures directory:", xdg.UserDirs.Pictures)
+		log.Println("Videos directory:", xdg.UserDirs.Videos)
+		log.Println("Templates directory:", xdg.UserDirs.Templates)
+		log.Println("Public directory:", xdg.UserDirs.PublicShare)
+	}
+*/
+package xdg
diff --git a/vendor/github.com/adrg/xdg/internal/pathutil/pathutil.go b/vendor/github.com/adrg/xdg/internal/pathutil/pathutil.go
new file mode 100644
index 00000000000..7422342b3c4
--- /dev/null
+++ b/vendor/github.com/adrg/xdg/internal/pathutil/pathutil.go
@@ -0,0 +1,78 @@
+package pathutil
+
+import (
+	"fmt"
+	"os"
+	"path/filepath"
+	"strings"
+)
+
+// Unique eliminates the duplicate paths from the provided slice and returns
+// the result. The items in the output slice are in the order in which they
+// occur in the input slice. If a `home` location is provided, the paths are
+// expanded using the `ExpandHome` function.
+func Unique(paths []string, home string) []string {
+	var (
+		uniq     []string
+		registry = map[string]struct{}{}
+	)
+
+	for _, p := range paths {
+		p = ExpandHome(p, home)
+		if p != "" && filepath.IsAbs(p) {
+			if _, ok := registry[p]; ok {
+				continue
+			}
+
+			registry[p] = struct{}{}
+			uniq = append(uniq, p)
+		}
+	}
+
+	return uniq
+}
+
+// Create returns a suitable location relative to which the file with the
+// specified `name` can be written. The first path from the provided `paths`
+// slice which is successfully created (or already exists) is used as a base
+// path for the file. The `name` parameter should contain the name of the file
+// which is going to be written in the location returned by this function, but
+// it can also contain a set of parent directories, which will be created
+// relative to the selected parent path.
+func Create(name string, paths []string) (string, error) {
+	var searchedPaths []string
+	for _, p := range paths {
+		p = filepath.Join(p, name)
+
+		dir := filepath.Dir(p)
+		if Exists(dir) {
+			return p, nil
+		}
+		if err := os.MkdirAll(dir, os.ModeDir|0700); err == nil {
+			return p, nil
+		}
+
+		searchedPaths = append(searchedPaths, dir)
+	}
+
+	return "", fmt.Errorf("could not create any of the following paths: %s",
+		strings.Join(searchedPaths, ", "))
+}
+
+// Search searches for the file with the specified `name` in the provided
+// slice of `paths`. The `name` parameter must contain the name of the file,
+// but it can also contain a set of parent directories.
+func Search(name string, paths []string) (string, error) {
+	var searchedPaths []string
+	for _, p := range paths {
+		p = filepath.Join(p, name)
+		if Exists(p) {
+			return p, nil
+		}
+
+		searchedPaths = append(searchedPaths, filepath.Dir(p))
+	}
+
+	return "", fmt.Errorf("could not locate `%s` in any of the following paths: %s",
+		filepath.Base(name), strings.Join(searchedPaths, ", "))
+}
diff --git a/vendor/github.com/adrg/xdg/internal/pathutil/pathutil_plan9.go b/vendor/github.com/adrg/xdg/internal/pathutil/pathutil_plan9.go
new file mode 100644
index 00000000000..8ee4e8d2fbe
--- /dev/null
+++ b/vendor/github.com/adrg/xdg/internal/pathutil/pathutil_plan9.go
@@ -0,0 +1,29 @@
+package pathutil
+
+import (
+	"os"
+	"path/filepath"
+	"strings"
+)
+
+// Exists returns true if the specified path exists.
+func Exists(path string) bool {
+	_, err := os.Stat(path)
+	return err == nil || os.IsExist(err)
+}
+
+// ExpandHome substitutes `~` and `$home` at the start of the specified
+// `path` using the provided `home` location.
+func ExpandHome(path, home string) string {
+	if path == "" || home == "" {
+		return path
+	}
+	if path[0] == '~' {
+		return filepath.Join(home, path[1:])
+	}
+	if strings.HasPrefix(path, "$home") {
+		return filepath.Join(home, path[5:])
+	}
+
+	return path
+}
diff --git a/vendor/github.com/adrg/xdg/internal/pathutil/pathutil_unix.go b/vendor/github.com/adrg/xdg/internal/pathutil/pathutil_unix.go
new file mode 100644
index 00000000000..a014c66ef67
--- /dev/null
+++ b/vendor/github.com/adrg/xdg/internal/pathutil/pathutil_unix.go
@@ -0,0 +1,32 @@
+//go:build aix || darwin || dragonfly || freebsd || (js && wasm) || nacl || linux || netbsd || openbsd || solaris
+// +build aix darwin dragonfly freebsd js,wasm nacl linux netbsd openbsd solaris
+
+package pathutil
+
+import (
+	"os"
+	"path/filepath"
+	"strings"
+)
+
+// Exists returns true if the specified path exists.
+func Exists(path string) bool {
+	_, err := os.Stat(path)
+	return err == nil || os.IsExist(err)
+}
+
+// ExpandHome substitutes `~` and `$HOME` at the start of the specified
+// `path` using the provided `home` location.
+func ExpandHome(path, home string) string {
+	if path == "" || home == "" {
+		return path
+	}
+	if path[0] == '~' {
+		return filepath.Join(home, path[1:])
+	}
+	if strings.HasPrefix(path, "$HOME") {
+		return filepath.Join(home, path[5:])
+	}
+
+	return path
+}
diff --git a/vendor/github.com/adrg/xdg/internal/pathutil/pathutil_windows.go b/vendor/github.com/adrg/xdg/internal/pathutil/pathutil_windows.go
new file mode 100644
index 00000000000..44080e3ab61
--- /dev/null
+++ b/vendor/github.com/adrg/xdg/internal/pathutil/pathutil_windows.go
@@ -0,0 +1,64 @@
+package pathutil
+
+import (
+	"os"
+	"path/filepath"
+	"strings"
+
+	"golang.org/x/sys/windows"
+)
+
+// Exists returns true if the specified path exists.
+func Exists(path string) bool {
+	fi, err := os.Lstat(path)
+	if fi != nil && fi.Mode()&os.ModeSymlink != 0 {
+		_, err = filepath.EvalSymlinks(path)
+	}
+
+	return err == nil || os.IsExist(err)
+}
+
+// ExpandHome substitutes `%USERPROFILE%` at the start of the specified
+// `path` using the provided `home` location.
+func ExpandHome(path, home string) string {
+	if path == "" || home == "" {
+		return path
+	}
+	if strings.HasPrefix(path, `%USERPROFILE%`) {
+		return filepath.Join(home, path[13:])
+	}
+
+	return path
+}
+
+// KnownFolder returns the location of the folder with the specified ID.
+// If that fails, the folder location is determined by reading the provided
+// environment variables (the first non-empty read value is returned).
+// If that fails as well, the first non-empty fallback is returned.
+// If all of the above fails, the function returns an empty string.
+func KnownFolder(id *windows.KNOWNFOLDERID, envVars []string, fallbacks []string) string {
+	if id != nil {
+		flags := []uint32{windows.KF_FLAG_DEFAULT, windows.KF_FLAG_DEFAULT_PATH}
+		for _, flag := range flags {
+			p, _ := windows.KnownFolderPath(id, flag|windows.KF_FLAG_DONT_VERIFY)
+			if p != "" {
+				return p
+			}
+		}
+	}
+
+	for _, envVar := range envVars {
+		p := os.Getenv(envVar)
+		if p != "" {
+			return p
+		}
+	}
+
+	for _, fallback := range fallbacks {
+		if fallback != "" {
+			return fallback
+		}
+	}
+
+	return ""
+}
diff --git a/vendor/github.com/adrg/xdg/paths_darwin.go b/vendor/github.com/adrg/xdg/paths_darwin.go
new file mode 100644
index 00000000000..bfe9ad9bc47
--- /dev/null
+++ b/vendor/github.com/adrg/xdg/paths_darwin.go
@@ -0,0 +1,60 @@
+package xdg
+
+import (
+	"os"
+	"path/filepath"
+)
+
+func homeDir() string {
+	if home := os.Getenv("HOME"); home != "" {
+		return home
+	}
+
+	return "/"
+}
+
+func initDirs(home string) {
+	initBaseDirs(home)
+	initUserDirs(home)
+}
+
+func initBaseDirs(home string) {
+	homeAppSupport := filepath.Join(home, "Library", "Application Support")
+	rootAppSupport := "/Library/Application Support"
+
+	// Initialize standard directories.
+	baseDirs.dataHome = xdgPath(envDataHome, homeAppSupport)
+	baseDirs.data = xdgPaths(envDataDirs, rootAppSupport)
+	baseDirs.configHome = xdgPath(envConfigHome, homeAppSupport)
+	baseDirs.config = xdgPaths(envConfigDirs,
+		filepath.Join(home, "Library", "Preferences"),
+		rootAppSupport,
+		"/Library/Preferences",
+	)
+	baseDirs.stateHome = xdgPath(envStateHome, homeAppSupport)
+	baseDirs.cacheHome = xdgPath(envCacheHome, filepath.Join(home, "Library", "Caches"))
+	baseDirs.runtime = xdgPath(envRuntimeDir, homeAppSupport)
+
+	// Initialize non-standard directories.
+	baseDirs.applications = []string{
+		"/Applications",
+	}
+
+	baseDirs.fonts = []string{
+		filepath.Join(home, "Library/Fonts"),
+		"/Library/Fonts",
+		"/System/Library/Fonts",
+		"/Network/Library/Fonts",
+	}
+}
+
+func initUserDirs(home string) {
+	UserDirs.Desktop = xdgPath(envDesktopDir, filepath.Join(home, "Desktop"))
+	UserDirs.Download = xdgPath(envDownloadDir, filepath.Join(home, "Downloads"))
+	UserDirs.Documents = xdgPath(envDocumentsDir, filepath.Join(home, "Documents"))
+	UserDirs.Music = xdgPath(envMusicDir, filepath.Join(home, "Music"))
+	UserDirs.Pictures = xdgPath(envPicturesDir, filepath.Join(home, "Pictures"))
+	UserDirs.Videos = xdgPath(envVideosDir, filepath.Join(home, "Movies"))
+	UserDirs.Templates = xdgPath(envTemplatesDir, filepath.Join(home, "Templates"))
+	UserDirs.PublicShare = xdgPath(envPublicShareDir, filepath.Join(home, "Public"))
+}
diff --git a/vendor/github.com/adrg/xdg/paths_plan9.go b/vendor/github.com/adrg/xdg/paths_plan9.go
new file mode 100644
index 00000000000..2882f688b3c
--- /dev/null
+++ b/vendor/github.com/adrg/xdg/paths_plan9.go
@@ -0,0 +1,55 @@
+package xdg
+
+import (
+	"os"
+	"path/filepath"
+)
+
+func homeDir() string {
+	if home := os.Getenv("home"); home != "" {
+		return home
+	}
+
+	return "/"
+}
+
+func initDirs(home string) {
+	initBaseDirs(home)
+	initUserDirs(home)
+}
+
+func initBaseDirs(home string) {
+	homeLibDir := filepath.Join(home, "lib")
+	rootLibDir := "/lib"
+
+	// Initialize standard directories.
+	baseDirs.dataHome = xdgPath(envDataHome, homeLibDir)
+	baseDirs.data = xdgPaths(envDataDirs, rootLibDir)
+	baseDirs.configHome = xdgPath(envConfigHome, homeLibDir)
+	baseDirs.config = xdgPaths(envConfigDirs, rootLibDir)
+	baseDirs.stateHome = xdgPath(envStateHome, filepath.Join(homeLibDir, "state"))
+	baseDirs.cacheHome = xdgPath(envCacheHome, filepath.Join(homeLibDir, "cache"))
+	baseDirs.runtime = xdgPath(envRuntimeDir, "/tmp")
+
+	// Initialize non-standard directories.
+	baseDirs.applications = []string{
+		filepath.Join(home, "bin"),
+		"/bin",
+	}
+
+	baseDirs.fonts = []string{
+		filepath.Join(homeLibDir, "font"),
+		"/lib/font",
+	}
+}
+
+func initUserDirs(home string) {
+	UserDirs.Desktop = xdgPath(envDesktopDir, filepath.Join(home, "desktop"))
+	UserDirs.Download = xdgPath(envDownloadDir, filepath.Join(home, "downloads"))
+	UserDirs.Documents = xdgPath(envDocumentsDir, filepath.Join(home, "documents"))
+	UserDirs.Music = xdgPath(envMusicDir, filepath.Join(home, "music"))
+	UserDirs.Pictures = xdgPath(envPicturesDir, filepath.Join(home, "pictures"))
+	UserDirs.Videos = xdgPath(envVideosDir, filepath.Join(home, "videos"))
+	UserDirs.Templates = xdgPath(envTemplatesDir, filepath.Join(home, "templates"))
+	UserDirs.PublicShare = xdgPath(envPublicShareDir, filepath.Join(home, "public"))
+}
diff --git a/vendor/github.com/adrg/xdg/paths_unix.go b/vendor/github.com/adrg/xdg/paths_unix.go
new file mode 100644
index 00000000000..ad571dfc811
--- /dev/null
+++ b/vendor/github.com/adrg/xdg/paths_unix.go
@@ -0,0 +1,71 @@
+//go:build aix || dragonfly || freebsd || (js && wasm) || nacl || linux || netbsd || openbsd || solaris
+// +build aix dragonfly freebsd js,wasm nacl linux netbsd openbsd solaris
+
+package xdg
+
+import (
+	"os"
+	"path/filepath"
+	"strconv"
+
+	"github.com/adrg/xdg/internal/pathutil"
+)
+
+func homeDir() string {
+	if home := os.Getenv("HOME"); home != "" {
+		return home
+	}
+
+	return "/"
+}
+
+func initDirs(home string) {
+	initBaseDirs(home)
+	initUserDirs(home)
+}
+
+func initBaseDirs(home string) {
+	// Initialize standard directories.
+	baseDirs.dataHome = xdgPath(envDataHome, filepath.Join(home, ".local", "share"))
+	baseDirs.data = xdgPaths(envDataDirs, "/usr/local/share", "/usr/share")
+	baseDirs.configHome = xdgPath(envConfigHome, filepath.Join(home, ".config"))
+	baseDirs.config = xdgPaths(envConfigDirs, "/etc/xdg")
+	baseDirs.stateHome = xdgPath(envStateHome, filepath.Join(home, ".local", "state"))
+	baseDirs.cacheHome = xdgPath(envCacheHome, filepath.Join(home, ".cache"))
+	baseDirs.runtime = xdgPath(envRuntimeDir, filepath.Join("/run/user", strconv.Itoa(os.Getuid())))
+
+	// Initialize non-standard directories.
+	appDirs := []string{
+		filepath.Join(baseDirs.dataHome, "applications"),
+		filepath.Join(home, ".local/share/applications"),
+		"/usr/local/share/applications",
+		"/usr/share/applications",
+	}
+
+	fontDirs := []string{
+		filepath.Join(baseDirs.dataHome, "fonts"),
+		filepath.Join(home, ".fonts"),
+		filepath.Join(home, ".local/share/fonts"),
+		"/usr/local/share/fonts",
+		"/usr/share/fonts",
+	}
+
+	for _, dir := range baseDirs.data {
+		appDirs = append(appDirs, filepath.Join(dir, "applications"))
+		fontDirs = append(fontDirs, filepath.Join(dir, "fonts"))
+	}
+
+	baseDirs.applications = pathutil.Unique(appDirs, Home)
+	baseDirs.fonts = pathutil.Unique(fontDirs, Home)
+}
+
+func initUserDirs(home string) {
+	UserDirs.Desktop = xdgPath(envDesktopDir, filepath.Join(home, "Desktop"))
+	UserDirs.Download = xdgPath(envDownloadDir, filepath.Join(home, "Downloads"))
+	UserDirs.Documents = xdgPath(envDocumentsDir, filepath.Join(home, "Documents"))
+	UserDirs.Music = xdgPath(envMusicDir, filepath.Join(home, "Music"))
+	UserDirs.Pictures = xdgPath(envPicturesDir, filepath.Join(home, "Pictures"))
+	UserDirs.Videos = xdgPath(envVideosDir, filepath.Join(home, "Videos"))
+	UserDirs.Templates = xdgPath(envTemplatesDir, filepath.Join(home, "Templates"))
+	UserDirs.PublicShare = xdgPath(envPublicShareDir, filepath.Join(home, "Public"))
+}
diff --git a/vendor/github.com/adrg/xdg/paths_windows.go b/vendor/github.com/adrg/xdg/paths_windows.go
new file mode 100644
index 00000000000..722d3e7856f
--- /dev/null
+++ b/vendor/github.com/adrg/xdg/paths_windows.go
@@ -0,0 +1,168 @@
+package xdg
+
+import (
+	"path/filepath"
+
+	"github.com/adrg/xdg/internal/pathutil"
+	"golang.org/x/sys/windows"
+)
+
+func homeDir() string {
+	return pathutil.KnownFolder(
+		windows.FOLDERID_Profile,
+		[]string{"USERPROFILE"},
+		nil,
+	)
+}
+
+func initDirs(home string) {
+	kf := initKnownFolders(home)
+	initBaseDirs(home, kf)
+	initUserDirs(home, kf)
+}
+
+func initBaseDirs(home string, kf *knownFolders) {
+	// Initialize standard directories.
+	baseDirs.dataHome = xdgPath(envDataHome, kf.localAppData)
+	baseDirs.data = xdgPaths(envDataDirs, kf.roamingAppData, kf.programData)
+	baseDirs.configHome = xdgPath(envConfigHome, kf.localAppData)
+	baseDirs.config = xdgPaths(envConfigDirs, kf.programData, kf.roamingAppData)
+	baseDirs.stateHome = xdgPath(envStateHome, kf.localAppData)
+	baseDirs.cacheHome = xdgPath(envCacheHome, filepath.Join(kf.localAppData, "cache"))
+	baseDirs.runtime = xdgPath(envRuntimeDir, kf.localAppData)
+
+	// Initialize non-standard directories.
+	baseDirs.applications = []string{
+		kf.programs,
+		kf.commonPrograms,
+	}
+	baseDirs.fonts = []string{
+		kf.fonts,
+		filepath.Join(kf.localAppData, "Microsoft", "Windows", "Fonts"),
+	}
+}
+
+func initUserDirs(home string, kf *knownFolders) {
+	UserDirs.Desktop = xdgPath(envDesktopDir, kf.desktop)
+	UserDirs.Download = xdgPath(envDownloadDir, kf.downloads)
+	UserDirs.Documents = xdgPath(envDocumentsDir, kf.documents)
+	UserDirs.Music = xdgPath(envMusicDir, kf.music)
+	UserDirs.Pictures = xdgPath(envPicturesDir, kf.pictures)
+	UserDirs.Videos = xdgPath(envVideosDir, kf.videos)
+	UserDirs.Templates = xdgPath(envTemplatesDir, kf.templates)
+	UserDirs.PublicShare = xdgPath(envPublicShareDir, kf.public)
+}
+
+type knownFolders struct {
+	systemDrive    string
+	systemRoot     string
+	programData    string
+	userProfile    string
+	userProfiles   string
+	roamingAppData string
+	localAppData   string
+	desktop        string
+	downloads      string
+	documents      string
+	music          string
+	pictures       string
+	videos         string
+	templates      string
+	public         string
+	fonts          string
+	programs       string
+	commonPrograms string
+}
+
+func initKnownFolders(home string) *knownFolders {
+	kf := &knownFolders{
+		userProfile: home,
+	}
+	kf.systemDrive = filepath.VolumeName(pathutil.KnownFolder(
+		windows.FOLDERID_Windows,
+		[]string{"SystemDrive", "SystemRoot", "windir"},
+		[]string{home, `C:`},
+	)) + string(filepath.Separator)
+	kf.systemRoot = pathutil.KnownFolder(
+		windows.FOLDERID_Windows,
+		[]string{"SystemRoot", "windir"},
+		[]string{filepath.Join(kf.systemDrive, "Windows")},
+	)
+	kf.programData = pathutil.KnownFolder(
+		windows.FOLDERID_ProgramData,
+		[]string{"ProgramData", "ALLUSERSPROFILE"},
+		[]string{filepath.Join(kf.systemDrive, "ProgramData")},
+	)
+	kf.userProfiles = pathutil.KnownFolder(
+		windows.FOLDERID_UserProfiles,
+		nil,
+		[]string{filepath.Join(kf.systemDrive, "Users")},
+	)
+	kf.roamingAppData = pathutil.KnownFolder(
+		windows.FOLDERID_RoamingAppData,
+		[]string{"APPDATA"},
+		[]string{filepath.Join(home, "AppData", "Roaming")},
+	)
+	kf.localAppData = pathutil.KnownFolder(
+		windows.FOLDERID_LocalAppData,
+		[]string{"LOCALAPPDATA"},
+		[]string{filepath.Join(home, "AppData", "Local")},
+	)
+	kf.desktop = pathutil.KnownFolder(
+		windows.FOLDERID_Desktop,
+		nil,
+		[]string{filepath.Join(home, "Desktop")},
+	)
+	kf.downloads = pathutil.KnownFolder(
+		windows.FOLDERID_Downloads,
+		nil,
+		[]string{filepath.Join(home, "Downloads")},
+	)
+	kf.documents = pathutil.KnownFolder(
+		windows.FOLDERID_Documents,
+		nil,
+		[]string{filepath.Join(home, "Documents")},
+	)
+	kf.music = pathutil.KnownFolder(
+		windows.FOLDERID_Music,
+		nil,
+		[]string{filepath.Join(home, "Music")},
+	)
+	kf.pictures = pathutil.KnownFolder(
+		windows.FOLDERID_Pictures,
+		nil,
+		[]string{filepath.Join(home, "Pictures")},
+	)
+	kf.videos = pathutil.KnownFolder(
+		windows.FOLDERID_Videos,
+		nil,
+		[]string{filepath.Join(home, "Videos")},
+	)
+	kf.templates = pathutil.KnownFolder(
+		windows.FOLDERID_Templates,
+		nil,
+		[]string{filepath.Join(kf.roamingAppData, "Microsoft", "Windows", "Templates")},
+	)
+	kf.public = pathutil.KnownFolder(
+		windows.FOLDERID_Public,
+		[]string{"PUBLIC"},
+		[]string{filepath.Join(kf.userProfiles, "Public")},
+	)
+	kf.fonts = pathutil.KnownFolder(
+		windows.FOLDERID_Fonts,
+		nil,
+		[]string{filepath.Join(kf.systemRoot, "Fonts")},
+	)
+	kf.programs = pathutil.KnownFolder(
+		windows.FOLDERID_Programs,
+		nil,
+		[]string{filepath.Join(kf.roamingAppData, "Microsoft", "Windows", "Start Menu", "Programs")},
+	)
+	kf.commonPrograms = pathutil.KnownFolder(
+		windows.FOLDERID_CommonPrograms,
+		nil,
+		[]string{filepath.Join(kf.programData, "Microsoft", "Windows", "Start Menu", "Programs")},
+	)
+
+	return kf
+}
diff --git a/vendor/github.com/adrg/xdg/user_dirs.go b/vendor/github.com/adrg/xdg/user_dirs.go
new file mode 100644
index 00000000000..72088748d0c
--- /dev/null
+++ b/vendor/github.com/adrg/xdg/user_dirs.go
@@ -0,0 +1,40 @@
+package xdg
+
+// XDG user directories environment variables.
+const (
+	envDesktopDir     = "XDG_DESKTOP_DIR"
+	envDownloadDir    = "XDG_DOWNLOAD_DIR"
+	envDocumentsDir   = "XDG_DOCUMENTS_DIR"
+	envMusicDir       = "XDG_MUSIC_DIR"
+	envPicturesDir    = "XDG_PICTURES_DIR"
+	envVideosDir      = "XDG_VIDEOS_DIR"
+	envTemplatesDir   = "XDG_TEMPLATES_DIR"
+	envPublicShareDir = "XDG_PUBLICSHARE_DIR"
+)
+
+// UserDirectories defines the locations of well known user directories.
+type UserDirectories struct {
+	// Desktop defines the location of the user's desktop directory.
+	Desktop string
+
+	// Download defines a suitable location for user downloaded files.
+	Download string
+
+	// Documents defines a suitable location for user document files.
+	Documents string
+
+	// Music defines a suitable location for user audio files.
+	Music string
+
+	// Pictures defines a suitable location for user image files.
+	Pictures string
+
+	// VideosDir defines a suitable location for user video files.
+	Videos string
+
+	// Templates defines a suitable location for user template files.
+	Templates string
+
+	// PublicShare defines a suitable location for user shared files.
+	PublicShare string
+}
diff --git a/vendor/github.com/adrg/xdg/xdg.go b/vendor/github.com/adrg/xdg/xdg.go
new file mode 100644
index 00000000000..3d33ca6e55d
--- /dev/null
+++ b/vendor/github.com/adrg/xdg/xdg.go
@@ -0,0 +1,218 @@
+package xdg
+
+import (
+	"os"
+	"path/filepath"
+
+	"github.com/adrg/xdg/internal/pathutil"
+)
+
+var (
+	// Home contains the path of the user's home directory.
+	Home string
+
+	// DataHome defines the base directory relative to which user-specific
+	// data files should be stored. This directory is defined by the
+	// $XDG_DATA_HOME environment variable. If the variable is not set,
+	// a default equal to $HOME/.local/share should be used.
+	DataHome string
+
+	// DataDirs defines the preference-ordered set of base directories to
+	// search for data files in addition to the DataHome base directory.
+	// This set of directories is defined by the $XDG_DATA_DIRS environment
+	// variable. If the variable is not set, the default directories
+	// to be used are /usr/local/share and /usr/share, in that order. The
+	// DataHome directory is considered more important than any of the
+	// directories defined by DataDirs. Therefore, user data files should be
+	// written relative to the DataHome directory, if possible.
+	DataDirs []string
+
+	// ConfigHome defines the base directory relative to which user-specific
+	// configuration files should be written. This directory is defined by
+	// the $XDG_CONFIG_HOME environment variable. If the variable is not
+	// not set, a default equal to $HOME/.config should be used.
+	ConfigHome string
+
+	// ConfigDirs defines the preference-ordered set of base directories to
+	// search for configuration files in addition to the ConfigHome base
+	// directory. This set of directories is defined by the $XDG_CONFIG_DIRS
+	// environment variable. If the variable is not set, a default equal
+	// to /etc/xdg should be used. The ConfigHome directory is considered
+	// more important than any of the directories defined by ConfigDirs.
+	// Therefore, user config files should be written relative to the
+	// ConfigHome directory, if possible.
+	ConfigDirs []string
+
+	// StateHome defines the base directory relative to which user-specific
+	// state files should be stored. This directory is defined by the
+	// $XDG_STATE_HOME environment variable. If the variable is not set,
+	// a default equal to ~/.local/state should be used.
+	StateHome string
+
+	// CacheHome defines the base directory relative to which user-specific
+	// non-essential (cached) data should be written. This directory is
+	// defined by the $XDG_CACHE_HOME environment variable. If the variable
+	// is not set, a default equal to $HOME/.cache should be used.
+	CacheHome string
+
+	// RuntimeDir defines the base directory relative to which user-specific
+	// non-essential runtime files and other file objects (such as sockets,
+	// named pipes, etc.) should be stored. This directory is defined by the
+	// $XDG_RUNTIME_DIR environment variable. If the variable is not set,
+	// applications should fall back to a replacement directory with similar
+	// capabilities. Applications should use this directory for communication
+	// and synchronization purposes and should not place larger files in it,
+	// since it might reside in runtime memory and cannot necessarily be
+	// swapped out to disk.
+	RuntimeDir string
+
+	// UserDirs defines the locations of well known user directories.
+	UserDirs UserDirectories
+
+	// FontDirs defines the common locations where font files are stored.
+	FontDirs []string
+
+	// ApplicationDirs defines the common locations of applications.
+	ApplicationDirs []string
+
+	// baseDirs defines the locations of base directories.
+	baseDirs baseDirectories
+)
+
+func init() {
+	Reload()
+}
+
+// Reload refreshes base and user directories by reading the environment.
+// Defaults are applied for XDG variables which are empty or not present
+// in the environment.
+func Reload() {
+	// Initialize home directory.
+	Home = homeDir()
+
+	// Initialize base and user directories.
+	initDirs(Home)
+
+	// Set standard directories.
+	DataHome = baseDirs.dataHome
+	DataDirs = baseDirs.data
+	ConfigHome = baseDirs.configHome
+	ConfigDirs = baseDirs.config
+	StateHome = baseDirs.stateHome
+	CacheHome = baseDirs.cacheHome
+	RuntimeDir = baseDirs.runtime
+
+	// Set non-standard directories.
+	FontDirs = baseDirs.fonts
+	ApplicationDirs = baseDirs.applications
+}
+
+// DataFile returns a suitable location for the specified data file.
+// The relPath parameter must contain the name of the data file, and
+// optionally, a set of parent directories (e.g. appname/app.data).
+// If the specified directories do not exist, they will be created relative
+// to the base data directory. On failure, an error containing the
+// attempted paths is returned.
+func DataFile(relPath string) (string, error) {
+	return baseDirs.dataFile(relPath)
+}
+
+// ConfigFile returns a suitable location for the specified config file.
+// The relPath parameter must contain the name of the config file, and
+// optionally, a set of parent directories (e.g. appname/app.yaml).
+// If the specified directories do not exist, they will be created relative
+// to the base config directory. On failure, an error containing the
+// attempted paths is returned.
+func ConfigFile(relPath string) (string, error) {
+	return baseDirs.configFile(relPath)
+}
+
+// StateFile returns a suitable location for the specified state file. State
+// files are usually volatile data files, not suitable to be stored relative
+// to the $XDG_DATA_HOME directory.
+// The relPath parameter must contain the name of the state file, and
+// optionally, a set of parent directories (e.g. appname/app.state).
+// If the specified directories do not exist, they will be created relative
+// to the base state directory. On failure, an error containing the
+// attempted paths is returned.
+func StateFile(relPath string) (string, error) {
+	return baseDirs.stateFile(relPath)
+}
+
+// CacheFile returns a suitable location for the specified cache file.
+// The relPath parameter must contain the name of the cache file, and
+// optionally, a set of parent directories (e.g. appname/app.cache).
+// If the specified directories do not exist, they will be created relative
+// to the base cache directory. On failure, an error containing the
+// attempted paths is returned.
+func CacheFile(relPath string) (string, error) {
+	return baseDirs.cacheFile(relPath)
+}
+
+// RuntimeFile returns a suitable location for the specified runtime file.
+// The relPath parameter must contain the name of the runtime file, and
+// optionally, a set of parent directories (e.g. appname/app.pid).
+// If the specified directories do not exist, they will be created relative
+// to the base runtime directory. On failure, an error containing the
+// attempted paths is returned.
+func RuntimeFile(relPath string) (string, error) {
+	return baseDirs.runtimeFile(relPath)
+}
+
+// SearchDataFile searches for specified file in the data search paths.
+// The relPath parameter must contain the name of the data file, and
+// optionally, a set of parent directories (e.g. appname/app.data). If the
+// file cannot be found, an error specifying the searched paths is returned.
+func SearchDataFile(relPath string) (string, error) {
+	return baseDirs.searchDataFile(relPath)
+}
+
+// SearchConfigFile searches for the specified file in config search paths.
+// The relPath parameter must contain the name of the config file, and
+// optionally, a set of parent directories (e.g. appname/app.yaml). If the
+// file cannot be found, an error specifying the searched paths is returned.
+func SearchConfigFile(relPath string) (string, error) {
+	return baseDirs.searchConfigFile(relPath)
+}
+
+// SearchStateFile searches for the specified file in the state search path.
+// The relPath parameter must contain the name of the state file, and
+// optionally, a set of parent directories (e.g. appname/app.state). If the
+// file cannot be found, an error specifying the searched path is returned.
+func SearchStateFile(relPath string) (string, error) {
+	return baseDirs.searchStateFile(relPath)
+}
+
+// SearchCacheFile searches for the specified file in the cache search path.
+// The relPath parameter must contain the name of the cache file, and
+// optionally, a set of parent directories (e.g. appname/app.cache). If the
+// file cannot be found, an error specifying the searched path is returned.
+func SearchCacheFile(relPath string) (string, error) {
+	return baseDirs.searchCacheFile(relPath)
+}
+
+// SearchRuntimeFile searches for the specified file in the runtime search path.
+// The relPath parameter must contain the name of the runtime file, and
+// optionally, a set of parent directories (e.g. appname/app.pid). If the
+// file cannot be found, an error specifying the searched path is returned.
+func SearchRuntimeFile(relPath string) (string, error) {
+	return baseDirs.searchRuntimeFile(relPath)
+}
+
+func xdgPath(name, defaultPath string) string {
+	dir := pathutil.ExpandHome(os.Getenv(name), Home)
+	if dir != "" && filepath.IsAbs(dir) {
+		return dir
+	}
+
+	return defaultPath
+}
+
+func xdgPaths(name string, defaultPaths ...string) []string {
+	dirs := pathutil.Unique(filepath.SplitList(os.Getenv(name)), Home)
+	if len(dirs) != 0 {
+		return dirs
+	}
+
+	return pathutil.Unique(defaultPaths, Home)
+}
diff --git a/vendor/modules.txt b/vendor/modules.txt
index 1b9f41882e8..eb3da7d6308 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -1,6 +1,7 @@
-# github.com/OpenPeeDeeP/xdg v1.0.0
-## explicit
-github.com/OpenPeeDeeP/xdg
+# github.com/adrg/xdg v0.4.0
+## explicit; go 1.14
+github.com/adrg/xdg
+github.com/adrg/xdg/internal/pathutil
 # github.com/atotto/clipboard v0.1.4
 ## explicit
 github.com/atotto/clipboard


Test patch: