use std::{ffi::OsString, path::PathBuf};
use crate::Source;
impl Source {
pub fn storage_location(self, env_var: &mut dyn FnMut(&str) -> Option<OsString>) -> Option<PathBuf> {
use Source::*;
Some(match self {
GitInstallation => gix_path::env::installation_config_prefix()?.join("gitattributes"),
System => {
if env_var("GIT_ATTR_NOSYSTEM").is_some() {
return None;
} else {
gix_path::env::system_prefix()?.join("etc/gitattributes")
}
}
Git => return gix_path::env::xdg_config("attributes", env_var),
Local => PathBuf::from("info/attributes"),
})
}
}