Skip to content

Commit 15e8cf5

Browse files
committed
fix: display the absolute path in installing note
1 parent 4fc7444 commit 15e8cf5

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/cargo/ops/cargo_install.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,15 @@ impl<'gctx> InstallablePackage<'gctx> {
316316
fn install_one(mut self, dry_run: bool) -> CargoResult<bool> {
317317
self.gctx.shell().status("Installing", &self.pkg)?;
318318

319+
// Normalize to absolute path for consistency throughout.
320+
// See: https://github.com/rust-lang/cargo/issues/16023
319321
let dst = self.root.join("bin").into_path_unlocked();
322+
let cwd = self.gctx.cwd();
323+
let dst = if dst.is_absolute() {
324+
paths::normalize_path(dst.as_path())
325+
} else {
326+
paths::normalize_path(&cwd.join(&dst))
327+
};
320328

321329
let mut td_opt = None;
322330
let mut needs_cleanup = false;

tests/testsuite/install.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ fn relative_install_location_without_trailing_slash() {
525525
[INSTALLING] foo v0.0.1 ([ROOT]/foo)
526526
[COMPILING] foo v0.0.1 ([ROOT]/foo)
527527
[FINISHED] `release` profile [optimized] target(s) in [ELAPSED]s
528-
[INSTALLING] t1/bin/foo[EXE]
528+
[INSTALLING] [ROOT]/foo/t1/bin/foo[EXE]
529529
[INSTALLED] package `foo v0.0.1 ([ROOT]/foo)` (executable `foo[EXE]`)
530530
[WARNING] be sure to add `t1/bin` to your PATH to be able to run the installed binaries
531531
@@ -605,7 +605,7 @@ fn relative_install_location_with_path_set() {
605605
[INSTALLING] foo v0.0.1 ([ROOT]/foo)
606606
[COMPILING] foo v0.0.1 ([ROOT]/foo)
607607
[FINISHED] `release` profile [optimized] target(s) in [ELAPSED]s
608-
[INSTALLING] t1/bin/foo[EXE]
608+
[INSTALLING] [ROOT]/foo/t1/bin/foo[EXE]
609609
[INSTALLED] package `foo v0.0.1 ([ROOT]/foo)` (executable `foo[EXE]`)
610610
[WARNING] be sure to add `t1/bin` to your PATH to be able to run the installed binaries
611611

0 commit comments

Comments
 (0)