Config: Create settings.yml if it doesn't exist
This commit is contained in:
parent
1a31e52eaa
commit
b3abe6840a
1 changed files with 7 additions and 5 deletions
|
@ -151,18 +151,20 @@ func (s *Settings) Save(fileName string) error {
|
|||
return err
|
||||
}
|
||||
|
||||
s.Propagate()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// initSettings initializes user settings from a config file.
|
||||
func (c *Config) initSettings() {
|
||||
c.settings = NewSettings()
|
||||
p := c.SettingsFile()
|
||||
fileName := c.SettingsFile()
|
||||
|
||||
if err := c.settings.Load(p); err != nil {
|
||||
log.Debugln(err)
|
||||
if err := c.settings.Load(fileName); err == nil {
|
||||
log.Debugf("config: loaded settings from %s ", fileName)
|
||||
} else if err := c.settings.Save(fileName); err != nil {
|
||||
log.Errorf("failed creating %s: %s", fileName, err)
|
||||
} else {
|
||||
log.Debugf("config: created %s ", fileName)
|
||||
}
|
||||
|
||||
i18n.SetDir(c.LocalesPath())
|
||||
|
|
Loading…
Reference in a new issue