From 6a5eb039f5cc48654a44c12090bad2d514afa9b1 Mon Sep 17 00:00:00 2001 From: minie4 Date: Mon, 6 Jan 2025 09:49:40 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Make=20sure=20data=20directory?= =?UTF-8?q?=20exists=20on=20first=20run?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config.go b/config.go index 680b210..f715d0f 100644 --- a/config.go +++ b/config.go @@ -38,6 +38,9 @@ func createDefaultConfig(name string) { dest_path := fmt.Sprintf("%s/%s.toml", CONFIG_DIR, name) source_path := fmt.Sprintf("sample_configs/%s.toml", name) + if _, err := os.Stat(CONFIG_DIR); errors.Is(err, os.ErrNotExist) { + os.MkdirAll(CONFIG_DIR, 0744) + } if _, err := os.Stat(dest_path); errors.Is(err, os.ErrNotExist) { content, err := sampleConfig.ReadFile(source_path) if err != nil {