Skip to content

Commit

Permalink
enh: Add XDG_CONFIG_HOME to pixi global default manifest path
Browse files Browse the repository at this point in the history
  • Loading branch information
hoxbro committed Nov 23, 2024
1 parent 1650d6a commit af86ae5
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/global/project/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,19 @@ impl Project {

/// Get the default path to the global manifest file
pub(crate) fn default_manifest_path() -> miette::Result<PathBuf> {
Self::manifest_dir().map(|dir| dir.join(MANIFEST_DEFAULT_NAME))
std::env::var_os("XDG_CONFIG_HOME")
.map(PathBuf::from)
.map(|dir| dir.join("pixi").join(MANIFEST_DEFAULT_NAME))
.or_else(|| {
dirs::home_dir().map(|dir| dir.join(".config").join("pixi").join(MANIFEST_DEFAULT_NAME))
})
.filter(|dir| dir.exists())
.or_else(|| {
Self::manifest_dir()
.map(|dir| dir.join(MANIFEST_DEFAULT_NAME))
.ok()
})
.ok_or_else(|| miette::miette!("could not determine default manifest path"))
}

/// Loads a project from manifest file.
Expand Down

0 comments on commit af86ae5

Please sign in to comment.