fix config dir detection
This commit is contained in:
BIN
bin/nwg-drawer
BIN
bin/nwg-drawer
Binary file not shown.
4
main.go
4
main.go
@@ -274,10 +274,10 @@ func main() {
|
|||||||
exFile := filepath.Join(configDirectory, "excluded-dirs")
|
exFile := filepath.Join(configDirectory, "excluded-dirs")
|
||||||
exclusions, err = loadTextFile(exFile)
|
exclusions, err = loadTextFile(exFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Infof("Search exclusions file %s not found", exFile)
|
log.Infof("Search exclusions file %s not found %s", exFile, err)
|
||||||
} else {
|
} else {
|
||||||
log.Infof("Found %v search exclusions in %s", len(exclusions), exFile)
|
log.Infof("Found %v search exclusions in %s", len(exclusions), exFile)
|
||||||
fmt.Println(exclusions)
|
log.Info(exclusions)
|
||||||
}
|
}
|
||||||
|
|
||||||
// USER INTERFACE
|
// USER INTERFACE
|
||||||
|
|||||||
10
tools.go
10
tools.go
@@ -160,12 +160,12 @@ func oldConfigDir() (string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func configDir() string {
|
func configDir() string {
|
||||||
if os.Getenv("XDG_CONFIG_HOME") != "" {
|
var home string
|
||||||
dir := path.Join(os.Getenv("XDG_CONFIG_HOME"), "nwg-drawer")
|
home = os.Getenv("XDG_CONFIG_HOME")
|
||||||
createDir(dir)
|
if home == "" {
|
||||||
return dir
|
home = os.Getenv("HOME")
|
||||||
}
|
}
|
||||||
dir := path.Join(os.Getenv("XDG_CONFIG_HOME"), "nwg-drawe")
|
dir := path.Join(home, ".config/nwg-drawer")
|
||||||
createDir(dir)
|
createDir(dir)
|
||||||
|
|
||||||
return dir
|
return dir
|
||||||
|
|||||||
Reference in New Issue
Block a user