mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-28 15:32:50 -05:00
feat: doctor command
This commit is contained in:
@@ -6,6 +6,30 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
func xdgDir(envVar string, defaultPath ...string) string {
|
||||
if dir := os.Getenv(envVar); dir != "" {
|
||||
return dir
|
||||
}
|
||||
home, _ := os.UserHomeDir()
|
||||
return filepath.Join(append([]string{home}, defaultPath...)...)
|
||||
}
|
||||
|
||||
func XDGConfigHome() string {
|
||||
return xdgDir("XDG_CONFIG_HOME", ".config")
|
||||
}
|
||||
|
||||
func XDGStateHome() string {
|
||||
return xdgDir("XDG_STATE_HOME", ".local", "state")
|
||||
}
|
||||
|
||||
func XDGCacheHome() string {
|
||||
return xdgDir("XDG_CACHE_HOME", ".cache")
|
||||
}
|
||||
|
||||
func XDGDataHome() string {
|
||||
return xdgDir("XDG_DATA_HOME", ".local", "share")
|
||||
}
|
||||
|
||||
func ExpandPath(path string) (string, error) {
|
||||
expanded := os.ExpandEnv(path)
|
||||
expanded = filepath.Clean(expanded)
|
||||
|
||||
Reference in New Issue
Block a user