From 1455cf9cb2ca7bcac7b7faabfb028cd856774c88 Mon Sep 17 00:00:00 2001 From: Bernd Schoolmann Date: Sat, 3 Feb 2024 23:15:29 +0100 Subject: [PATCH] Fix config dir creation on windows --- agent/config/config.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/agent/config/config.go b/agent/config/config.go index 88791e6..ac81136 100644 --- a/agent/config/config.go +++ b/agent/config/config.go @@ -471,7 +471,10 @@ func (config *Config) WriteConfig() error { os.Remove(config.ConfigFile.RuntimeConfig.ConfigDirectory) parentDirectory := config.ConfigFile.RuntimeConfig.ConfigDirectory[:len(config.ConfigFile.RuntimeConfig.ConfigDirectory)-len("/goldwarden.json")] if _, err := os.Stat(parentDirectory); os.IsNotExist(err) { - os.Mkdir(parentDirectory, 0700) + err := os.MkdirAll(parentDirectory, 0700) + if err != nil { + return err + } } file, err := os.OpenFile(config.ConfigFile.RuntimeConfig.ConfigDirectory, os.O_CREATE|os.O_WRONLY, 0600)