fix: stabilize cache behavior and local xdg paths

This commit is contained in:
Rasyidan Akbar F. 2026-03-17 08:52:11 +07:00
commit 018b8aeb55
2 changed files with 17 additions and 2 deletions

View file

@ -197,6 +197,11 @@ pub fn default_config_toml() -> String {
}
pub fn config_path() -> Result<PathBuf, IdxError> {
if let Ok(dir) = std::env::var("XDG_CONFIG_HOME")
&& !dir.is_empty()
{
return Ok(PathBuf::from(dir).join("idx").join("config.toml"));
}
ProjectDirs::from("", "", "idx")
.map(|d| d.config_dir().join("config.toml"))
.ok_or_else(|| IdxError::ConfigError("unable to resolve config dir".to_string()))