diff --git a/CHANGELOG.md b/CHANGELOG.md index 397b35e..1a00af3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ # v0.2.2 (2024-07-04) +- improve handling of default xdg config dir (unix only) - fix typos # v0.2.1 (2024-07-04) diff --git a/src/main.rs b/src/main.rs index 83003a7..389ba39 100644 --- a/src/main.rs +++ b/src/main.rs @@ -117,7 +117,9 @@ fn fetch_all_results(username: &str, host: &str, token: &str) -> Response { fn config_file_path() -> Result> { #[cfg(target_family = "unix")] let config_os_dir = { - let home = std::env::var("HOME")?; + // First look for XDG_CONFIG_HOME, then fall back to HOME + // https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html + let home = std::env::var("XDG_CONFIG_HOME").unwrap_or(std::env::var("HOME")?); PathBuf::from(home).join(".config") }; #[cfg(target_family = "windows")]