mirror of
https://github.com/Hopiu/micro.git
synced 2026-04-10 01:21:02 +00:00
parent
1defb1d039
commit
648070c6d2
1 changed files with 9 additions and 2 deletions
|
|
@ -51,8 +51,15 @@ func InitSettings() {
|
|||
|
||||
// WriteSettings writes the settings to the specified filename as JSON
|
||||
func WriteSettings(filename string) error {
|
||||
txt, _ := json.MarshalIndent(settings, "", " ")
|
||||
err := ioutil.WriteFile(filename, txt, 0644)
|
||||
var err error
|
||||
home, err := homedir.Dir()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if _, e := os.Stat(home + "/.micro"); e == nil {
|
||||
txt, _ := json.MarshalIndent(settings, "", " ")
|
||||
err = ioutil.WriteFile(filename, txt, 0644)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue