Skip to content
This repository was archived by the owner on Dec 9, 2023. It is now read-only.

Commit 2f3f8bc

Browse files
committed
Fix filepaths for windows
1 parent d7683cc commit 2f3f8bc

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

cmd/config.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,14 +172,14 @@ func mapConfig(cfgFile string) config {
172172
}
173173

174174
if cfgFile == "" {
175-
defaultPath := home + "/.config/devdash/"
175+
defaultPath := filepath.Join(home, ".config", "devdash")
176176
cfgFile = defaultConfig(defaultPath, "default.yml")
177177
}
178178

179179
// viper.AddConfigPath(home)
180180
viper.AddConfigPath(".")
181-
viper.AddConfigPath("$XDG_CONFIG_HOME/devdash/")
182-
viper.AddConfigPath(home + "/.config/devdash/")
181+
viper.AddConfigPath(filepath.Join("$XDG_CONFIG_HOME", "devdash"))
182+
viper.AddConfigPath(filepath.Join(home, ".config", "devdash"))
183183

184184
viper.SetConfigName(removeExt(cfgFile))
185185
err = viper.ReadInConfig()
@@ -210,7 +210,7 @@ func defaultConfig(path string, filename string) string {
210210
os.MkdirAll(path, 0755)
211211
}
212212

213-
f := path + filename
213+
f := filepath.Join(path, filename)
214214
if _, err := os.Stat(f); os.IsNotExist(err) {
215215
file, _ := os.Create(f)
216216
defer file.Close()

0 commit comments

Comments
 (0)