mirror of
https://github.com/0xrsydn/idx-cli.git
synced 2026-08-07 01:33:52 +00:00
fix: stabilize cache behavior and local xdg paths
This commit is contained in:
parent
e20b41642f
commit
018b8aeb55
2 changed files with 17 additions and 2 deletions
|
|
@ -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()))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue