1
0
mirror of https://github.com/hrfee/jfa-go.git synced 2024-12-23 01:20:11 +00:00

setup: MkdirAll config dir if necessary

some have had this issue in the past on new systems/users where ~/.config
doesn't exist yet.
This commit is contained in:
Harvey Tindall 2021-07-27 10:54:52 +01:00
parent 67c60cb677
commit 6e88c1f4fc
Signed by: hrfee
GPG Key ID: BBC65952848FB1A2

View File

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