From 6bd8f49b7024dd6b4a77fc6d340f0b565347205e Mon Sep 17 00:00:00 2001 From: Christian Claus Date: Wed, 11 Apr 2018 15:58:21 +0200 Subject: [PATCH] Add base dir creation on startup --- app/config.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/config.go b/app/config.go index 93ca499..be98ad3 100644 --- a/app/config.go +++ b/app/config.go @@ -111,6 +111,11 @@ func (cfg *Config) updateConfig(e fsnotify.Event) { } func (cfg *Config) ensureUserDirs() { + if _, err := os.Stat(cfg.Dir); os.IsNotExist(err) { + os.Mkdir(cfg.Dir, os.ModePerm) + fmt.Printf("Created base dir: %s\n", cfg.Dir) + } + for username := range cfg.Users { path := filepath.Join(cfg.Dir, username) if _, err := os.Stat(path); os.IsNotExist(err) {