mirror of
https://github.com/Jguer/yay
synced 2024-10-31 04:12:51 +00:00
Make sure enviroment paths are not empty
This commit is contained in:
parent
e5d7cce49c
commit
7fdb5c2007
1 changed files with 12 additions and 0 deletions
12
main.go
12
main.go
|
@ -12,16 +12,28 @@ import (
|
|||
|
||||
func setPaths() error {
|
||||
if _configHome, set := os.LookupEnv("XDG_CONFIG_HOME"); set {
|
||||
if _configHome == "" {
|
||||
fmt.Errorf("XDG_CONFIG_HOME set but empty")
|
||||
}
|
||||
configHome = filepath.Join(_configHome, "yay")
|
||||
} else if _configHome, set := os.LookupEnv("HOME"); set {
|
||||
if _configHome == "" {
|
||||
fmt.Errorf("HOME set but empty")
|
||||
}
|
||||
configHome = filepath.Join(_configHome, ".config/yay")
|
||||
} else {
|
||||
fmt.Errorf("XDG_CONFIG_HOME and HOME unset")
|
||||
}
|
||||
|
||||
if _cacheHome, set := os.LookupEnv("XDG_CACHE_HOME"); set {
|
||||
if _cacheHome == "" {
|
||||
fmt.Errorf("XDG_CACHE_HOME set but empty")
|
||||
}
|
||||
cacheHome = filepath.Join(_cacheHome, "yay")
|
||||
} else if _cacheHome, set := os.LookupEnv("HOME"); set {
|
||||
if _cacheHome == "" {
|
||||
fmt.Errorf("XDG_CACHE_HOME set but empty")
|
||||
}
|
||||
cacheHome = filepath.Join(_cacheHome, ".cache/yay")
|
||||
} else {
|
||||
fmt.Errorf("XDG_CACHE_HOME and HOME unset")
|
||||
|
|
Loading…
Reference in a new issue