aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config/general.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/config/general.go b/config/general.go
index 6fd37dcf..e90deffe 100644
--- a/config/general.go
+++ b/config/general.go
@@ -3,6 +3,7 @@ package config
import (
"fmt"
"os"
+ "path/filepath"
"git.sr.ht/~rjarry/aerc/lib/log"
"git.sr.ht/~rjarry/aerc/lib/xdg"
@@ -39,6 +40,10 @@ func parseGeneral(file *ini.File) error {
} else if General.LogFile != "" {
var err error
path := xdg.ExpandHome(General.LogFile)
+ err = os.MkdirAll(filepath.Dir(path), 0o700)
+ if err != nil {
+ return fmt.Errorf("log-file: %w", err)
+ }
logFile, err = os.OpenFile(path,
os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0o600)
if err != nil {