From ae7c8791fdb80d4024b2ac0b1c6bba4036ad8c2f Mon Sep 17 00:00:00 2001 From: Ixentus Date: Fri, 2 Sep 2022 15:54:54 +0000 Subject: [PATCH] Update to notify 5.0 stable (#5865) # 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) --- crates/bevy_asset/Cargo.toml | 2 +- crates/bevy_asset/src/filesystem_watcher.rs | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/crates/bevy_asset/Cargo.toml b/crates/bevy_asset/Cargo.toml index 61a1f4dec6612..bd6874d683f83 100644 --- a/crates/bevy_asset/Cargo.toml +++ b/crates/bevy_asset/Cargo.toml @@ -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] diff --git a/crates/bevy_asset/src/filesystem_watcher.rs b/crates/bevy_asset/src/filesystem_watcher.rs index 5ee499e80e3ed..ace2500cd5b8f 100644 --- a/crates/bevy_asset/src/filesystem_watcher.rs +++ b/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. @@ -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 } }