Add base dir creation on startup

This commit is contained in:
Christian Claus 2018-04-11 15:58:21 +02:00
parent db1867ee61
commit 6bd8f49b70

View file

@ -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) {