Skip to content

Commit

Permalink
fix crash on MacOS in notify crate when path is set first time
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikolay Plekhanov committed Oct 13, 2024
1 parent 8e3445c commit 2af3b0d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions editor/src/asset/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -885,8 +885,14 @@ impl AssetBrowser {
message_sender: &MessageSender,
) {
if let Some(watcher) = self.watcher.as_mut() {
Log::verify(watcher.unwatch(&self.selected_path));
Log::verify(watcher.watch(path, RecursiveMode::NonRecursive));
if self.selected_path.exists() {
Log::verify(watcher.unwatch(&self.selected_path));
}
if path.exists() {
Log::verify(watcher.watch(path, RecursiveMode::NonRecursive));
} else {
Log::err(format!("cannot watch non-existing path {:?}", path));
}
}

self.selected_path = path.to_path_buf();
Expand Down

0 comments on commit 2af3b0d

Please sign in to comment.