Skip to content

Commit eca9806

Browse files
committed
fix: display the absolute path in the warning
1 parent 15e8cf5 commit eca9806

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/cargo/ops/cargo_install.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,15 @@ pub fn install(
663663
lockfile_path: Option<&Path>,
664664
) -> CargoResult<()> {
665665
let root = resolve_root(root, gctx)?;
666+
// Normalize to absolute path for consistency throughout.
667+
// See: https://github.com/rust-lang/cargo/issues/16023
666668
let dst = root.join("bin").into_path_unlocked();
669+
let cwd = gctx.cwd();
670+
let dst = if dst.is_absolute() {
671+
paths::normalize_path(dst.as_path())
672+
} else {
673+
paths::normalize_path(&cwd.join(&dst))
674+
};
667675
let map = SourceConfigMap::new(gctx)?;
668676

669677
let current_rust_version = if opts.honor_rust_version.unwrap_or(true) {

tests/testsuite/install.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ fn relative_install_location_without_trailing_slash() {
527527
[FINISHED] `release` profile [optimized] target(s) in [ELAPSED]s
528528
[INSTALLING] [ROOT]/foo/t1/bin/foo[EXE]
529529
[INSTALLED] package `foo v0.0.1 ([ROOT]/foo)` (executable `foo[EXE]`)
530-
[WARNING] be sure to add `t1/bin` to your PATH to be able to run the installed binaries
530+
[WARNING] be sure to add `[ROOT]/foo/t1/bin` to your PATH to be able to run the installed binaries
531531
532532
"#]])
533533
.run();
@@ -607,7 +607,6 @@ fn relative_install_location_with_path_set() {
607607
[FINISHED] `release` profile [optimized] target(s) in [ELAPSED]s
608608
[INSTALLING] [ROOT]/foo/t1/bin/foo[EXE]
609609
[INSTALLED] package `foo v0.0.1 ([ROOT]/foo)` (executable `foo[EXE]`)
610-
[WARNING] be sure to add `t1/bin` to your PATH to be able to run the installed binaries
611610
612611
"#]])
613612
.run();

0 commit comments

Comments
 (0)