Add base dir creation on startup
This commit is contained in:
parent
db1867ee61
commit
6bd8f49b70
1 changed files with 5 additions and 0 deletions
|
@ -111,6 +111,11 @@ func (cfg *Config) updateConfig(e fsnotify.Event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cfg *Config) ensureUserDirs() {
|
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 {
|
for username := range cfg.Users {
|
||||||
path := filepath.Join(cfg.Dir, username)
|
path := filepath.Join(cfg.Dir, username)
|
||||||
if _, err := os.Stat(path); os.IsNotExist(err) {
|
if _, err := os.Stat(path); os.IsNotExist(err) {
|
||||||
|
|
Loading…
Reference in a new issue