From cfaf9736f42cd7c4e6eb6f3b696d0343834aec7c Mon Sep 17 00:00:00 2001 From: eric Date: Fri, 6 Aug 2021 06:06:21 +0800 Subject: [PATCH] chore: notify -> 5.0.0-pre.11 --- leaf/Cargo.toml | 2 +- leaf/src/lib.rs | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/leaf/Cargo.toml b/leaf/Cargo.toml index 2051d5e..6fdde89 100644 --- a/leaf/Cargo.toml +++ b/leaf/Cargo.toml @@ -207,7 +207,7 @@ rustls = { version = "0.19", optional = true } warp = { version = "0.3", default-features = false, optional = true } # Auto reload -notify = { version = "5.0.0-pre.6", optional = true } +notify = { version = "5.0.0-pre.11", optional = true } # TUN [target.'cfg(any(target_os = "ios", target_os = "android", target_os = "macos", target_os = "linux"))'.dependencies] diff --git a/leaf/src/lib.rs b/leaf/src/lib.rs index d703556..d442a8e 100644 --- a/leaf/src/lib.rs +++ b/leaf/src/lib.rs @@ -189,7 +189,7 @@ impl RuntimeManager { log::trace!("starting new watcher for config file: {}", config_path); let rt_id = self.rt_id; let mut watcher: RecommendedWatcher = - Watcher::new_immediate(move |res: NotifyResult| { + notify::recommended_watcher(move |res: NotifyResult| { match res { // FIXME Not sure what are the most appropriate events to // filter on different platforms. @@ -245,7 +245,10 @@ impl RuntimeManager { }) .map_err(Error::Watcher)?; watcher - .watch(config_path, RecursiveMode::NonRecursive) + .watch( + std::path::Path::new(&config_path), + RecursiveMode::NonRecursive, + ) .map_err(Error::Watcher)?; log::info!("watching changes of file: {}", config_path); self.watcher.lock().unwrap().replace(watcher);