Skip to content

Commit

Permalink
Merge pull request #17 from messense/fix-windows-nightly
Browse files Browse the repository at this point in the history
Fix Windows nightly error caused by rust-lang/rust#92519
  • Loading branch information
messense authored Mar 20, 2022
2 parents 56fbfd1 + ce6ff22 commit e9bdf52
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 {
const VERBATIM_PREFIX: &str = r#"\\?\"#;
if p.starts_with(VERBATIM_PREFIX) {
p[VERBATIM_PREFIX.len()..].to_string()
} else {
p
}
}

0 comments on commit e9bdf52

Please sign in to comment.