Skip to content

Commit

Permalink
🐛 - Fix a bug where copying files to /lib/* triggered an infinite
Browse files Browse the repository at this point in the history
loop
  • Loading branch information
rolandpeelen committed Jul 24, 2023
1 parent 493cba9 commit c0932ff
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/watcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,21 @@ async fn async_watch(
let needs_compile = events.iter().any(|event| {
event.paths.iter().any(|path| {
let path_buf = path.to_path_buf();

let is_in_bs_build_path = path_buf
.to_str()
.map(|x| x.contains("/lib/bs/") || x.contains("/lib/ocaml/"))
.unwrap_or(false);

let name = path_buf
.file_name()
.and_then(|x| x.to_str())
.unwrap_or("Unknown")
.to_string();

let extension = path_buf.extension().and_then(|ext| ext.to_str());
match extension {
Some(extension) => {
match (is_in_bs_build_path, extension) {
(false, Some(extension)) => {
(helpers::is_implementation_file(&extension)
|| helpers::is_interface_file(&extension))
&& filter
Expand Down

0 comments on commit c0932ff

Please sign in to comment.