Skip to content

Commit

Permalink
Try macOS-specific logic
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbrochart committed Nov 4, 2022
1 parent fc7a379 commit a7ae0d5
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,16 @@ impl RustNotify {
changes.remove(&(CHANGE_DELETED, path.clone(), EMPTY_STRING));
CHANGE_MOVED
}
EventKind::Modify(ModifyKind::Name(_)) => {
// On macOS the modify name event is triggered when a file is renamed,
// but no information about whether the src or dst path is available.
// Hence we have to check if the file exists instead.
if Path::new(&path).exists() {
CHANGE_ADDED
} else {
CHANGE_DELETED
}
}
EventKind::Remove(_) => CHANGE_DELETED,
_ => return,
};
Expand Down

0 comments on commit a7ae0d5

Please sign in to comment.