From 6e88c1f4fc16269c43f9b83c523ab6f5df83da88 Mon Sep 17 00:00:00 2001 From: Harvey Tindall Date: Tue, 27 Jul 2021 10:54:52 +0100 Subject: [PATCH] setup: MkdirAll config dir if necessary some have had this issue in the past on new systems/users where ~/.config doesn't exist yet. --- main.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main.go b/main.go index 8fab274..506aa8d 100644 --- a/main.go +++ b/main.go @@ -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)