multiple fixes

This commit is contained in:
piotr
2021-09-28 02:40:23 +02:00
parent a9fe4a7371
commit 1f91ade8e6
4 changed files with 37 additions and 20 deletions

View File

@@ -154,18 +154,23 @@ func oldConfigDir() (string, error) {
if os.Getenv("XDG_CONFIG_HOME") != "" {
dir := path.Join(os.Getenv("XDG_CONFIG_HOME"), "nwg-panel")
return dir, nil
} else if os.Getenv("HOME") != "" {
dir := path.Join(os.Getenv("HOME"), ".config/nwg-panel")
return dir, nil
}
return "", errors.New("old config dir not found")
}
func configDir() string {
var home string
home = os.Getenv("XDG_CONFIG_HOME")
if home == "" {
home = os.Getenv("HOME")
var dir string
if os.Getenv("XDG_CONFIG_HOME") != "" {
dir = path.Join(os.Getenv("XDG_CONFIG_HOME"), "nwg-drawer")
} else if os.Getenv("HOME") != "" {
dir = path.Join(os.Getenv("HOME"), ".config/nwg-drawer")
}
dir := path.Join(home, ".config/nwg-drawer")
log.Infof("Config dir: %s", dir)
createDir(dir)
return dir