diff --git a/crates/lib/src/config.rs b/crates/lib/src/config.rs index cdd76711d..1ec47b4e3 100644 --- a/crates/lib/src/config.rs +++ b/crates/lib/src/config.rs @@ -69,6 +69,14 @@ fn get_pkgx_dir() -> io::Result { } } + // Use sudoer home directory if it is set. + if let Ok(path) = env::var("SUDO_HOME") { + let path = PathBuf::from(path).join(".pkgx"); + if path.is_absolute() { + return Ok(path); + } + } + let default = dirs_next::home_dir().map(|x| x.join(".pkgx")); if default.clone().is_some_and(|x| x.exists()) {