Use filepath.Join more

This commit is contained in:
Zachary Yedidia
2020-02-11 13:09:17 -05:00
parent 34724b941a
commit 695d4c2b1b
8 changed files with 20 additions and 16 deletions

View File

@@ -3,6 +3,7 @@ package config
import (
"errors"
"os"
"path/filepath"
homedir "github.com/mitchellh/go-homedir"
)
@@ -24,10 +25,10 @@ func InitConfigDir(flagConfigDir string) error {
if err != nil {
return errors.New("Error finding your home directory\nCan't load config files: " + err.Error())
}
xdgHome = home + "/.config"
xdgHome = filepath.Join(home, ".config")
}
microHome = xdgHome + "/micro"
microHome = filepath.Join(xdgHome, "micro")
}
ConfigDir = microHome

View File

@@ -147,7 +147,7 @@ func RegisterCommonOptionPlug(pl string, name string, defaultvalue interface{})
if v, ok := GlobalSettings[name]; !ok {
defaultCommonSettings[name] = defaultvalue
GlobalSettings[name] = defaultvalue
err := WriteSettings(filepath.Join(ConfigDir, "/settings.json"))
err := WriteSettings(filepath.Join(ConfigDir, "settings.json"))
if err != nil {
return errors.New("Error writing settings.json file: " + err.Error())
}