From 108c16eebd1d3de3641c9cdec48314596d01b1b8 Mon Sep 17 00:00:00 2001 From: Jeremy Drake Date: Mon, 26 May 2025 10:31:56 -0700 Subject: [PATCH] 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. --- src/bootstrap/src/core/build_steps/install.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/bootstrap/src/core/build_steps/install.rs b/src/bootstrap/src/core/build_steps/install.rs index 585adf9be1604..5419540aa2e08 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..])) } }