Skip to content

Commit

Permalink
Update to notify 5.0 stable (#5865)
Browse files Browse the repository at this point in the history
# Objective

- Update notify dependency to 5.0.0 stable
- Fix breaking changes
- Closes #5861

## Solution

- RecommendedWatcher now takes a Config argument. Giving it the default Config should be the same behavior as before (check every 30 seconds)
  • Loading branch information
Ixentus committed Sep 2, 2022
1 parent 662c6e9 commit 17d84e8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion crates/bevy_asset/Cargo.toml
Expand Up @@ -30,7 +30,7 @@ anyhow = "1.0.4"
thiserror = "1.0"
downcast-rs = "1.2.0"
fastrand = "1.7.0"
notify = { version = "=5.0.0-pre.15", optional = true }
notify = { version = "5.0.0", optional = true }
parking_lot = "0.12.1"

[target.'cfg(target_arch = "wasm32")'.dependencies]
Expand Down
11 changes: 7 additions & 4 deletions crates/bevy_asset/src/filesystem_watcher.rs
@@ -1,5 +1,5 @@
use crossbeam_channel::Receiver;
use notify::{Event, RecommendedWatcher, RecursiveMode, Result, Watcher};
use notify::{Config, Event, RecommendedWatcher, RecursiveMode, Result, Watcher};
use std::path::Path;

/// Watches for changes to files on the local filesystem.
Expand All @@ -14,9 +14,12 @@ pub struct FilesystemWatcher {
impl Default for FilesystemWatcher {
fn default() -> Self {
let (sender, receiver) = crossbeam_channel::unbounded();
let watcher: RecommendedWatcher = RecommendedWatcher::new(move |res| {
sender.send(res).expect("Watch event send failure.");
})
let watcher: RecommendedWatcher = RecommendedWatcher::new(
move |res| {
sender.send(res).expect("Watch event send failure.");
},
Config::default(),
)
.expect("Failed to create filesystem watcher.");
FilesystemWatcher { watcher, receiver }
}
Expand Down

0 comments on commit 17d84e8

Please sign in to comment.