ensure presence of home and home/db dir's during creation of the default config file

This commit is contained in:
Will Scott 2018-03-08 05:07:25 -08:00
commit 90edffb1d7
2 changed files with 8 additions and 13 deletions

View file

@ -118,6 +118,14 @@ func (c *Config) Default() error {
if err != nil {
return err
}
if _, e := os.Stat(filepath.Join(home, "db")); e != nil {
err = os.MkdirAll(filepath.Join(home, "db"), 0700)
if err != nil {
return err
}
}
c.path = filepath.Join(home, "config.json")
return nil
}