Skip to content

Commit

Permalink
Fix Windows nightly error caused by rust-lang/rust#92519
Browse files Browse the repository at this point in the history
  • Loading branch information
messense committed Mar 20, 2022
1 parent 56fbfd1 commit ce6ff22
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/zig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -360,11 +360,24 @@ fn write_linker_wrapper(path: &Path, command: &str, args: &str) -> Result<()> {
writeln!(
&mut custom_linker_file,
"{} zig {} -- {} %*",
current_exe, command, args
adjust_canonicalization(current_exe),
command,
args
)?;
Ok(())
}

pub(crate) fn is_mingw_shell() -> bool {
env::var_os("MSYSTEM").is_some() && env::var_os("SHELL").is_some()
}

// https://stackoverflow.com/a/50323079/3549270
#[cfg(target_os = "windows")]
pub fn adjust_canonicalization(p: String) -> String {

This comment has been minimized.

Copy link
@TheOnlyArtz

TheOnlyArtz Mar 24, 2022

Contributor

There's much more to UNC than that, maybe refer to https://lib.rs/crates/dunce

This comment has been minimized.

Copy link
@messense

messense Mar 24, 2022

Author Member

Thanks, I'm gonna wait for rust-lang/rust#95178 to see if we can revert this.

const VERBATIM_PREFIX: &str = r#"\\?\"#;
if p.starts_with(VERBATIM_PREFIX) {
p[VERBATIM_PREFIX.len()..].to_string()
} else {
p
}
}

0 comments on commit ce6ff22

Please sign in to comment.