Skip to content

Commit

Permalink
DO NOT MERGE: Try removing cygpath from run-make
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisDenton committed Aug 3, 2024
1 parent 27a378f commit e861f93
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions src/tools/run-make-support/src/external_deps/cygpath.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
use std::path::Path;

use crate::command::Command;

/// Use `cygpath -w` on a path to get a Windows path string back. This assumes that `cygpath` is
/// available on the platform!
///
Expand All @@ -19,18 +17,7 @@ use crate::command::Command;
/// > -- *from [cygpath documentation](https://cygwin.com/cygwin-ug-net/cygpath.html)*.
#[track_caller]
#[must_use]
// FIXME: If try job succeeds, remove this function entirely.
pub fn get_windows_path<P: AsRef<Path>>(path: P) -> String {
// If the path looks unixy then use cygpath otherwise return it unchanged.
// If cygpath fails then fallback to just using the path as given.
if path.as_ref().starts_with("/") {
let mut cygpath = Command::new("cygpath");
cygpath.arg("-w");
cygpath.arg(path.as_ref());
let output = cygpath.run();
if output.status().success() {
// cygpath -w can attach a newline
return output.stdout_utf8().trim().to_string();
}
}
path.as_ref().to_str().unwrap().into()
}

0 comments on commit e861f93

Please sign in to comment.