Skip to content

Commit

Permalink
Fix windows rebuilding without any changes (rerun-io#1201)
Browse files Browse the repository at this point in the history
This is caused by `glob` not supporting verbatim windows paths. This PR works around this by "de-verbatizing" paths with a hack.
  • Loading branch information
Wumpf authored Feb 11, 2023
1 parent 9520003 commit a87167f
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions crates/re_renderer/build.rs
Original file line number Diff line number Diff line change
@@ -19,6 +19,12 @@ use walkdir::{DirEntry, WalkDir};

// Mapping to cargo:rerun-if-changed with glob support
fn rerun_if_changed(path: &str) {
// Workaround for windows verbatim paths not working with glob.
// Issue: https://github.com/rust-lang/glob/issues/111
// Fix: https://github.com/rust-lang/glob/pull/112
// Fixed on upstream, but no release containing the fix as of writing.
let path = path.trim_start_matches(r"\\?\");

for path in glob::glob(path).unwrap() {
println!("cargo:rerun-if-changed={}", path.unwrap().to_string_lossy());
}
6 changes: 6 additions & 0 deletions crates/re_web_server/build.rs
Original file line number Diff line number Diff line change
@@ -10,6 +10,12 @@ use std::{

// Mapping to cargo:rerun-if-changed with glob support
fn rerun_if_changed(path: &str) {
// Workaround for windows verbatim paths not working with glob.
// Issue: https://github.com/rust-lang/glob/issues/111
// Fix: https://github.com/rust-lang/glob/pull/112
// Fixed on upstream, but no release containing the fix as of writing.
let path = path.trim_start_matches(r"\\?\");

for path in glob::glob(path).unwrap() {
println!("cargo:rerun-if-changed={}", path.unwrap().to_string_lossy());
}

0 comments on commit a87167f

Please sign in to comment.