on main help sign in
fix: rethink global config path on windows: use `$HOME/.config` (#1352)
9272218Andrey Nering
README.md+1−1
@@ -211,7 +211,7 @@ or globally, with the following priority:
211
211
2121. `.crush.json`
2121. `.crush.json`
2132. `crush.json`
2132. `crush.json`
214−3. `$HOME/.config/crush/crush.json` (Windows: `%USERPROFILE%\AppData\Local\crush\crush.json`)
214+3. `$HOME/.config/crush/crush.json`
215
215
216Configuration itself is stored as a JSON object:
216Configuration itself is stored as a JSON object:
217
217
internal/config/load.go−11
@@ -662,17 +662,6 @@ func GlobalConfig() string {
662 return filepath.Join(xdgConfigHome, appName, fmt.Sprintf("%s.json", appName))
662 return filepath.Join(xdgConfigHome, appName, fmt.Sprintf("%s.json", appName))
663 }
663 }
664
664
665− // return the path to the main config directory
666− // for windows, it should be in `%LOCALAPPDATA%/crush/`
667− // for linux and macOS, it should be in `$HOME/.config/crush/`
668− if runtime.GOOS == "windows" {
669− localAppData := os.Getenv("LOCALAPPDATA")
670− if localAppData == "" {
671− localAppData = filepath.Join(os.Getenv("USERPROFILE"), "AppData", "Local")
672− }
673− return filepath.Join(localAppData, appName, fmt.Sprintf("%s.json", appName))
674− }
675−
676 return filepath.Join(home.Dir(), ".config", appName, fmt.Sprintf("%s.json", appName))
665 return filepath.Join(home.Dir(), ".config", appName, fmt.Sprintf("%s.json", appName))
677}
666}
678
667