Skip to content

Commit bbd0e9f

Browse files
committed
Auto merge of #128611 - ChrisDenton:cygpath, r=<try>
run-make: Only use cygpath if the path looks unixy `cygpath -w` can mangle paths that are already Windows paths. Therefore only use it if the path looks like a Unix path. Additionally fallback to using the path as given if `cygpath` fails on the assumption that the path is already good or else will be an error when it's actually used. Tbh, I'm not entirely convinced that `cygpath` is necessary but if it is used then it shouldn't get in the way of using Windows paths. try-job: x86_64-msvc try-job: i686-msvc try-job: i686-mingw try-job: x86_64-mingw
2 parents bbf60c8 + e861f93 commit bbd0e9f

File tree

1 file changed

+2
-14
lines changed
  • src/tools/run-make-support/src/external_deps

1 file changed

+2
-14
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
use std::panic;
21
use std::path::Path;
32

4-
use crate::command::Command;
5-
use crate::util::handle_failed_output;
6-
73
/// Use `cygpath -w` on a path to get a Windows path string back. This assumes that `cygpath` is
84
/// available on the platform!
95
///
@@ -21,15 +17,7 @@ use crate::util::handle_failed_output;
2117
/// > -- *from [cygpath documentation](https://cygwin.com/cygwin-ug-net/cygpath.html)*.
2218
#[track_caller]
2319
#[must_use]
20+
// FIXME: If try job succeeds, remove this function entirely.
2421
pub fn get_windows_path<P: AsRef<Path>>(path: P) -> String {
25-
let caller = panic::Location::caller();
26-
let mut cygpath = Command::new("cygpath");
27-
cygpath.arg("-w");
28-
cygpath.arg(path.as_ref());
29-
let output = cygpath.run();
30-
if !output.status().success() {
31-
handle_failed_output(&cygpath, output, caller.line());
32-
}
33-
// cygpath -w can attach a newline
34-
output.stdout_utf8().trim().to_string()
22+
path.as_ref().to_str().unwrap().into()
3523
}

0 commit comments

Comments
 (0)