mirror of
https://github.com/0xrsydn/idx-cli.git
synced 2026-08-07 01:33:52 +00:00
Merge pull request #12 from 0xrsydn/fix/resilient-cache
fix(cache): treat corrupted cache entries as cache misses
This commit is contained in:
commit
db4ff4f9fe
2 changed files with 97 additions and 5 deletions
|
|
@ -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()))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue