From 0ff6400ce7a8b4c9a282611ce5233e5a0db98b5f Mon Sep 17 00:00:00 2001 From: finn Date: Mon, 28 Mar 2022 09:42:37 -0700 Subject: [PATCH] signaldctl: create config directory if missing --- cmd/signaldctl/config/config.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/signaldctl/config/config.go b/cmd/signaldctl/config/config.go index 319f0a1..41de719 100644 --- a/cmd/signaldctl/config/config.go +++ b/cmd/signaldctl/config/config.go @@ -18,6 +18,7 @@ package config import ( "log" "os" + "path" "gopkg.in/yaml.v2" ) @@ -54,6 +55,9 @@ func Load() error { } func Save() error { + if err := os.MkdirAll(path.Dir(Path), 0660); err != nil { + return err + } f, err := os.Create(Path) if err != nil { return err