mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-26 06:22:50 -05:00
core: use stdlib for xdg dirs
This commit is contained in:
@@ -20,33 +20,3 @@ func ExpandPath(path string) (string, error) {
|
||||
|
||||
return expanded, nil
|
||||
}
|
||||
|
||||
func XDGConfigHome() string {
|
||||
if configHome := os.Getenv("XDG_CONFIG_HOME"); configHome != "" {
|
||||
return configHome
|
||||
}
|
||||
if home, err := os.UserHomeDir(); err == nil {
|
||||
return filepath.Join(home, ".config")
|
||||
}
|
||||
return filepath.Join(os.TempDir(), ".config")
|
||||
}
|
||||
|
||||
func XDGCacheHome() string {
|
||||
if cacheHome := os.Getenv("XDG_CACHE_HOME"); cacheHome != "" {
|
||||
return cacheHome
|
||||
}
|
||||
if home, err := os.UserHomeDir(); err == nil {
|
||||
return filepath.Join(home, ".cache")
|
||||
}
|
||||
return filepath.Join(os.TempDir(), ".cache")
|
||||
}
|
||||
|
||||
func XDGDataHome() string {
|
||||
if dataHome := os.Getenv("XDG_DATA_HOME"); dataHome != "" {
|
||||
return dataHome
|
||||
}
|
||||
if home, err := os.UserHomeDir(); err == nil {
|
||||
return filepath.Join(home, ".local", "share")
|
||||
}
|
||||
return filepath.Join(os.TempDir(), ".local", "share")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user