File tree Expand file tree Collapse file tree 2 files changed +6
-16
lines changed Expand file tree Collapse file tree 2 files changed +6
-16
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ use crate::sources::source::QueryKind;
2121use crate :: sources:: source:: Source ;
2222use crate :: util:: GlobalContext ;
2323use crate :: util:: cache_lock:: CacheLockMode ;
24+ use crate :: util:: context:: ConfigRelativePath ;
2425use crate :: util:: errors:: CargoResult ;
2526use crate :: util:: { FileLock , Filesystem } ;
2627
@@ -545,11 +546,14 @@ impl InstallInfo {
545546
546547/// Determines the root directory where installation is done.
547548pub 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}
Original file line number Diff line number Diff line change @@ -981,20 +981,6 @@ impl GlobalContext {
981981 self . get :: < OptValue < String > > ( key)
982982 }
983983
984- /// Get a config value that is expected to be a path.
985- ///
986- /// This returns a relative path if the value does not contain any
987- /// directory separators. See `ConfigRelativePath::resolve_program` for
988- /// more details.
989- pub fn get_path ( & self , key : & str ) -> CargoResult < OptValue < PathBuf > > {
990- self . get :: < OptValue < ConfigRelativePath > > ( key) . map ( |v| {
991- v. map ( |v| Value {
992- val : v. val . resolve_program ( self ) ,
993- definition : v. definition ,
994- } )
995- } )
996- }
997-
998984 fn string_to_path ( & self , value : & str , definition : & Definition ) -> PathBuf {
999985 let is_path = value. contains ( '/' ) || ( cfg ! ( windows) && value. contains ( '\\' ) ) ;
1000986 if is_path {
You can’t perform that action at this time.
0 commit comments