Merge pull request #12 from 0xrsydn/fix/resilient-cache

fix(cache): treat corrupted cache entries as cache misses
This commit is contained in:
Rasyidan A F 2026-03-17 09:03:15 +07:00 committed by GitHub
commit db4ff4f9fe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 97 additions and 5 deletions

View file

@ -197,6 +197,14 @@ 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()
{
let path = PathBuf::from(dir);
if path.is_absolute() {
return Ok(path.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()))