Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix patching on Windows #33

Merged
merged 1 commit into from Sep 26, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion libquickjs-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,16 @@ fn apply_patches(code_dir: &PathBuf) {
for patch in fs::read_dir("./embed/patches").expect("Could not open patches directory") {
let patch = patch.expect("Could not open patch");
eprintln!("Applying {:?}...", patch.file_name());

// the patch is copied to avoid escaping issues on Windows
let mut patch_copy = code_dir.clone();
patch_copy.push(patch.file_name());
fs::copy(patch.path(), patch_copy).expect("Could not copy patch file");

let status = std::process::Command::new("patch")
.current_dir(&code_dir)
.arg("-i")
.arg(fs::canonicalize(patch.path()).expect("Cannot canonicalize patch path"))
.arg(patch.file_name())
.spawn()
.expect("Could not apply patches")
.wait()
Expand Down