about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2025-05-27 13:01:37 +0200
committerGitHub <noreply@github.com>2025-05-27 13:01:37 +0200
commitf1371a8891d88610831776211ddf28512dc27db6 (patch)
tree22a73b52417df4572e03fbf8debdedb9b6f5103a /src
parentb7854c65a99a38b6c61a5335b39ed2743a362375 (diff)
parent108c16eebd1d3de3641c9cdec48314596d01b1b8 (diff)
downloadrust-f1371a8891d88610831776211ddf28512dc27db6.tar.gz
rust-f1371a8891d88610831776211ddf28512dc27db6.zip
Rollup merge of #141556 - jeremyd2019:patch-1, r=jieyouxu
bootstrap: translate Windows paths in a way that works for both Cygwin and MSYS2

Cygwin defaults to rooting Windows paths in /cygdrive/X, while MSYS2 configures them to be /X.  Regardless of configuration, drives are always accessible as /proc/cygdrive/X, so use that.

If there are other shells on Windows that are supported and use /X style paths, perhaps something more complicated needs to be done.

r? `@jieyouxu`

`@Berrysoft` `@mati865`
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap/src/core/build_steps/install.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/bootstrap/src/core/build_steps/install.rs b/src/bootstrap/src/core/build_steps/install.rs
index 585adf9be16..5419540aa2e 100644
--- a/src/bootstrap/src/core/build_steps/install.rs
+++ b/src/bootstrap/src/core/build_steps/install.rs
@@ -38,7 +38,9 @@ fn sanitize_sh(path: &Path, is_cygwin: bool) -> String {
         if ch.next() != Some('/') {
             return None;
         }
-        Some(format!("/{}/{}", drive, &s[drive.len_utf8() + 2..]))
+        // The prefix for Windows drives in Cygwin/MSYS2 is configurable, but
+        // /proc/cygdrive is available regardless of configuration since 1.7.33
+        Some(format!("/proc/cygdrive/{}/{}", drive, &s[drive.len_utf8() + 2..]))
     }
 }