Skip to content

Commit

Permalink
Fix paths for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
tgross35 committed Oct 23, 2023
1 parent 720f936 commit 52388eb
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions rcrypto-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,24 +37,29 @@ fn update_tests() {
}

let test_name = fname.strip_suffix(".c").unwrap().replace('-', "_");
let exe_path = format!(
"{out_dir}/c-out/test_{test_name}.{EXE_EXTENSION}",
out_dir = out_dir.to_string_lossy()
);
let mut exe_path = out_dir.clone();
exe_path.extend(["c-out", &format!("test_{test_name}.{EXE_EXTENSION}")]);
let exe_path_str = exe_path.to_string_lossy();
let exe_path_str = exe_path_str.replace(r"\", r"\\");
// escape backslashes
// let exe_path = format!(
// "{out_dir}/c-out/test_{test_name}.{EXE_EXTENSION}",
// out_dir = out_dir.to_string_lossy()
// );

write!(
indoc::writedoc!(
to_write,
indoc! {"
"
#[test]
fn test_{test_name}() {{
run_setup();
let mut cmd = Command::new(\"{exe_path}\");
run_cmd_else_quit(&mut cmd, \"{fname}\");
}}
"},
",
test_name = test_name,
exe_path = exe_path,
exe_path = exe_path_str,
fname = fname,
)
.unwrap();
Expand Down

0 comments on commit 52388eb

Please sign in to comment.