refactor(path): use XDG config for all platforms (#119)

closes #112
Replace `os.UserConfigDir()` with explicit `~/.config` fallback to align
macOS, Linux, and other platforms on same config location
Respects `XDG_CONFIG_HOME` if set, otherwise uses `~/.config/iris/`
This commit is contained in:
VERSE
2026-08-04 23:51:59 +07:00
committed by GitHub
parent 75aa1fbe38
commit d299d1c7c7
+4 -4
View File
@@ -10,11 +10,11 @@ func ConfigPath() (string, error) {
if configHome != "" { if configHome != "" {
return filepath.Join(configHome, "iris", "config.toml"), nil return filepath.Join(configHome, "iris", "config.toml"), nil
} }
dir, err := os.UserConfigDir() home, err := os.UserHomeDir()
if err != nil { if err != nil {
return "", err return "", err
} }
return filepath.Join(dir, "iris", "config.toml"), nil return filepath.Join(home, ".config", "iris", "config.toml"), nil
} }
func ThemePath() (string, error) { func ThemePath() (string, error) {
@@ -22,11 +22,11 @@ func ThemePath() (string, error) {
if configHome != "" { if configHome != "" {
return filepath.Join(configHome, "iris", "theme.toml"), nil return filepath.Join(configHome, "iris", "theme.toml"), nil
} }
dir, err := os.UserConfigDir() home, err := os.UserHomeDir()
if err != nil { if err != nil {
return "", err return "", err
} }
return filepath.Join(dir, "iris", "theme.toml"), nil return filepath.Join(home, ".config", "iris", "theme.toml"), nil
} }
func StatePath() (string, error) { func StatePath() (string, error) {