fix config dir detection

This commit is contained in:
piotr
2021-09-27 01:38:00 +02:00
parent fa3a8d9bb7
commit 419c991b95
3 changed files with 7 additions and 7 deletions

Binary file not shown.

View File

@@ -274,10 +274,10 @@ func main() {
exFile := filepath.Join(configDirectory, "excluded-dirs")
exclusions, err = loadTextFile(exFile)
if err != nil {
log.Infof("Search exclusions file %s not found", exFile)
log.Infof("Search exclusions file %s not found %s", exFile, err)
} else {
log.Infof("Found %v search exclusions in %s", len(exclusions), exFile)
fmt.Println(exclusions)
log.Info(exclusions)
}
// USER INTERFACE

View File

@@ -160,12 +160,12 @@ func oldConfigDir() (string, error) {
}
func configDir() string {
if os.Getenv("XDG_CONFIG_HOME") != "" {
dir := path.Join(os.Getenv("XDG_CONFIG_HOME"), "nwg-drawer")
createDir(dir)
return dir
var home string
home = os.Getenv("XDG_CONFIG_HOME")
if home == "" {
home = os.Getenv("HOME")
}
dir := path.Join(os.Getenv("XDG_CONFIG_HOME"), "nwg-drawe")
dir := path.Join(home, ".config/nwg-drawer")
createDir(dir)
return dir