ensure presence of home and home/db dir's during creation of the default config file
This commit is contained in:
parent
7e9a4fc3b7
commit
90edffb1d7
2 changed files with 8 additions and 13 deletions
8
ooni.go
8
ooni.go
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue