skip loading if file doesn't exist
This commit is contained in:
BIN
bin/nwg-drawer
BIN
bin/nwg-drawer
Binary file not shown.
8
main.go
8
main.go
@@ -263,21 +263,29 @@ func main() {
|
|||||||
// For opening files we use xdg-open. As its configuration is PITA, we may override some associations
|
// For opening files we use xdg-open. As its configuration is PITA, we may override some associations
|
||||||
// in the ~/.config/nwg-panel/preferred-apps.json file.
|
// in the ~/.config/nwg-panel/preferred-apps.json file.
|
||||||
paFile := path.Join(configDirectory, "preferred-apps.json")
|
paFile := path.Join(configDirectory, "preferred-apps.json")
|
||||||
|
if pathExists(paFile) {
|
||||||
preferredApps, err = loadPreferredApps(paFile)
|
preferredApps, err = loadPreferredApps(paFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Infof("Custom associations file %s not found or invalid", paFile)
|
log.Infof("Custom associations file %s not found or invalid", paFile)
|
||||||
} else {
|
} else {
|
||||||
log.Infof("Found %v associations in %s", len(preferredApps), paFile)
|
log.Infof("Found %v associations in %s", len(preferredApps), paFile)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
log.Infof("%s file not found", paFile)
|
||||||
|
}
|
||||||
|
|
||||||
// Load user-defined paths excluded from file search
|
// Load user-defined paths excluded from file search
|
||||||
exFile := path.Join(configDirectory, "excluded-dirs")
|
exFile := path.Join(configDirectory, "excluded-dirs")
|
||||||
|
if pathExists(exFile) {
|
||||||
exclusions, err = loadTextFile(exFile)
|
exclusions, err = loadTextFile(exFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Infof("Search exclusions file %s not found %s", exFile, err)
|
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)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
log.Infof("%s file not found", exFile)
|
||||||
|
}
|
||||||
|
|
||||||
// USER INTERFACE
|
// USER INTERFACE
|
||||||
gtk.Init(nil)
|
gtk.Init(nil)
|
||||||
|
|||||||
Reference in New Issue
Block a user