Skip to content

Commit 7523e6c

Browse files
committed
fix another path issue
1 parent 9508964 commit 7523e6c

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

rewatch/src/watcher.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,17 @@ fn is_rescript_file(path_buf: &Path) -> bool {
3232
}
3333

3434
fn is_in_build_path(path_buf: &Path) -> bool {
35-
path_buf
36-
.to_str()
37-
.map(|x| x.contains("/lib/bs/") || x.contains("/lib/ocaml/"))
38-
.unwrap_or(false)
35+
let mut prev_component: Option<&std::ffi::OsStr> = None;
36+
for component in path_buf.components() {
37+
let comp_os = component.as_os_str();
38+
if let Some(prev) = prev_component {
39+
if prev == "lib" && (comp_os == "bs" || comp_os == "ocaml") {
40+
return true;
41+
}
42+
}
43+
prev_component = Some(comp_os);
44+
}
45+
false
3946
}
4047

4148
fn matches_filter(path_buf: &Path, filter: &Option<regex::Regex>) -> bool {

0 commit comments

Comments
 (0)