setup: MkdirAll config dir if necessary

some have had this issue in the past on new systems/users where ~/.config
doesn't exist yet.
pull/163/head
Harvey Tindall 4 years ago
parent 67c60cb677
commit 6e88c1f4fc
No known key found for this signature in database
GPG Key ID: BBC65952848FB1A2

@ -190,6 +190,9 @@ func start(asDaemon, firstCall bool) {
app.err.Fatalf("Couldn't find default config file") app.err.Fatalf("Couldn't find default config file")
} }
nConfig, err := os.Create(app.configPath) nConfig, err := os.Create(app.configPath)
if err != nil && os.IsNotExist(err) {
err = os.MkdirAll(filepath.Dir(app.configPath), 0760)
}
if err != nil { if err != nil {
app.err.Printf("Couldn't open config file for writing: \"%s\"", app.configPath) app.err.Printf("Couldn't open config file for writing: \"%s\"", app.configPath)
app.err.Fatalf("Error: %s", err) app.err.Fatalf("Error: %s", err)

Loading…
Cancel
Save