summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormatthieu <matthieu.cneude@gmail.com>2020-11-24 12:41:48 +0100
committermatthieu <matthieu.cneude@gmail.com>2020-11-24 12:41:48 +0100
commitf16fc6e106ca66433f127fb3ea38ef41c6434a01 (patch)
tree657133754b77ecf34744c8cce45c1e25d660bf3b
parent8389ed20ba5ae331da763fa3235dd3b5c5d570fe (diff)
Fix pathfiles to make it work on Windows
-rw-r--r--cmd/config.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/cmd/config.go b/cmd/config.go
index d5fda16..e584254 100644
--- a/cmd/config.go
+++ b/cmd/config.go
@@ -172,14 +172,14 @@ func mapConfig(cfgFile string) config {
}
if cfgFile == "" {
- defaultPath := home + "/.config/devdash/"
+ defaultPath := filepath.Join(home, ".config", "devdash")
cfgFile = defaultConfig(defaultPath, "default.yml")
}
// viper.AddConfigPath(home)
viper.AddConfigPath(".")
- viper.AddConfigPath("$XDG_CONFIG_HOME/devdash/")
- viper.AddConfigPath(home + "/.config/devdash/")
+ viper.AddConfigPath(filepath.Join("$XDG_CONFIG_HOME", "devdash"))
+ viper.AddConfigPath(filepath.Join(home, ".config", "devdash"))
viper.SetConfigName(removeExt(cfgFile))
err = viper.ReadInConfig()
@@ -210,7 +210,7 @@ func defaultConfig(path string, filename string) string {
os.MkdirAll(path, 0755)
}
- f := path + filename
+ f := filepath.Join(path, filename)
if _, err := os.Stat(f); os.IsNotExist(err) {
file, _ := os.Create(f)
defer file.Close()