1
Fork 0

Convert UNC path to local path to satisfy install script on Windows

This commit is contained in:
Joseph Rafael Ferrer 2020-11-23 21:51:55 +08:00
parent 32da90b431
commit 6b47920c69

View file

@ -1183,7 +1183,11 @@ impl Step for PlainSourceTarball {
// characters and on `C:\` paths, so normalize both of them away.
pub fn sanitize_sh(path: &Path) -> String {
let path = path.to_str().unwrap().replace("\\", "/");
return change_drive(&path).unwrap_or(path);
return change_drive(unc_to_lfs(&path)).unwrap_or(path);
fn unc_to_lfs(s: &str) -> &str {
if s.starts_with("//?/") { &s[4..] } else { s }
}
fn change_drive(s: &str) -> Option<String> {
let mut ch = s.chars();