1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-05 00:59:19 +02:00

Switch to github.com/adrg/xdg

This commit is contained in:
Ching Pei Yang
2023-08-17 13:52:55 +02:00
committed by Stefan Haller
parent 4302018437
commit 2118ecdf8e
30 changed files with 1515 additions and 363 deletions

68
vendor/github.com/adrg/xdg/base_dirs.go generated vendored Normal file
View File

@ -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})
}