Skip to content

Commit 79e2090

Browse files
committed
fix: always display the absolute path in the warning
1 parent 7763ea0 commit 79e2090

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/cargo/ops/cargo_install.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -777,14 +777,20 @@ pub fn install(
777777
if installed_anything {
778778
// Print a warning that if this directory isn't in PATH that they won't be
779779
// able to run these commands.
780+
let cwd = gctx.cwd();
781+
let dst_abs = if dst.is_absolute() {
782+
paths::normalize_path(dst.as_path())
783+
} else {
784+
paths::normalize_path(&cwd.join(&dst))
785+
};
780786
let path = gctx.get_env_os("PATH").unwrap_or_default();
781787
let dst_in_path = env::split_paths(&path).any(|path| path == dst);
782788

783789
if !dst_in_path {
784790
gctx.shell().warn(&format!(
785791
"be sure to add `{}` to your PATH to be \
786792
able to run the installed binaries",
787-
dst.display()
793+
dst_abs.display()
788794
))?;
789795
}
790796
}

tests/testsuite/install.rs

Lines changed: 1 addition & 1 deletion
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] 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();

0 commit comments

Comments
 (0)