Skip to content

Commit f8e1c9f

Browse files
committed
refactor: inline GlobalContext::get_path
1 parent d80156f commit f8e1c9f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/cargo/ops/common_for_install_and_uninstall.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ use crate::sources::source::QueryKind;
2121
use crate::sources::source::Source;
2222
use crate::util::GlobalContext;
2323
use crate::util::cache_lock::CacheLockMode;
24+
use crate::util::context::ConfigRelativePath;
2425
use crate::util::errors::CargoResult;
2526
use crate::util::{FileLock, Filesystem};
2627

@@ -545,11 +546,14 @@ impl InstallInfo {
545546

546547
/// Determines the root directory where installation is done.
547548
pub fn resolve_root(flag: Option<&str>, gctx: &GlobalContext) -> CargoResult<Filesystem> {
548-
let config_root = gctx.get_path("install.root")?;
549+
let config_root = gctx
550+
.get::<Option<ConfigRelativePath>>("install.root")?
551+
.map(|p| p.resolve_program(gctx));
552+
549553
Ok(flag
550554
.map(PathBuf::from)
551555
.or_else(|| gctx.get_env_os("CARGO_INSTALL_ROOT").map(PathBuf::from))
552-
.or_else(move || config_root.map(|v| v.val))
556+
.or_else(|| config_root)
553557
.map(Filesystem::new)
554558
.unwrap_or_else(|| gctx.home().clone()))
555559
}

0 commit comments

Comments
 (0)