Skip to content

Commit d704b65

Browse files
author
Jon Gjengset
committed
Canonicalize paths only when needed
1 parent bd37135 commit d704b65

File tree

3 files changed

+4
-9
lines changed

3 files changed

+4
-9
lines changed

src/config.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -552,11 +552,11 @@ impl Cfg {
552552
}
553553
OverrideReason::OverrideDB(ref path) => format!(
554554
"the directory override for '{}' specifies an uninstalled toolchain",
555-
path.display()
555+
utils::canonicalize_path(path, self.notify_handler.as_ref()).display(),
556556
),
557557
OverrideReason::ToolchainFile(ref path) => format!(
558558
"the toolchain file at '{}' specifies an uninstalled toolchain",
559-
path.display()
559+
utils::canonicalize_path(path, self.notify_handler.as_ref()).display(),
560560
),
561561
};
562562

@@ -593,8 +593,7 @@ impl Cfg {
593593
settings: &Settings,
594594
) -> Result<Option<(OverrideFile, OverrideReason)>> {
595595
let notify = self.notify_handler.as_ref();
596-
let dir = utils::canonicalize_path(dir, notify);
597-
let mut dir = Some(&*dir);
596+
let mut dir = Some(dir);
598597

599598
while let Some(d) = dir {
600599
// First check the override database

src/toolchain.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ impl<'a> Toolchain<'a> {
9393

9494
Ok(Toolchain {
9595
cfg,
96-
name: path
96+
name: utils::canonicalize_path(&path, cfg.notify_handler.as_ref())
9797
.to_str()
9898
.ok_or_else(|| ErrorKind::InvalidToolchainPath(path.clone().into()))?
9999
.to_owned(),

tests/cli-rustup.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1516,10 +1516,6 @@ fn proxy_override_path() {
15161516
}
15171517

15181518
#[test]
1519-
#[cfg_attr(
1520-
windows,
1521-
ignore = "FIXME: Windows uses UNC paths which do not work with relative paths"
1522-
)]
15231519
fn file_override_path_relative() {
15241520
setup(&|config| {
15251521
expect_ok(config, &["rustup", "default", "stable"]);

0 commit comments

Comments
 (0)