diff --git a/Cargo.lock b/Cargo.lock index 2090b0c..0740eec 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -12,7 +12,7 @@ dependencies = [ "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "mktemp 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "nix 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "notify 2.6.3 (registry+https://github.com/rust-lang/crates.io-index)", + "notify 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -225,17 +225,16 @@ dependencies = [ [[package]] name = "notify" -version = "2.6.3" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bitflags 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "filetime 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "fsevent 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", "fsevent-sys 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "inotify 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", "walkdir 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -415,7 +414,7 @@ dependencies = [ "checksum net2 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)" = "5edf9cb6be97212423aed9413dd4729d62b370b5e1c571750e882cebbbc1e3e2" "checksum nix 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bfb3ddedaa14746434a02041940495bf11325c22f6d36125d3bdd56090d50a79" "checksum nix 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a0d95c5fa8b641c10ad0b8887454ebaafa3c92b5cd5350f8fc693adafd178e7b" -"checksum notify 2.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4e0e7eec936337952c4228b023007528a33b2fa039d96c2e8f32d764221a9c07" +"checksum notify 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2a29c8a989715f71d2e8272e335a34e657957040cc4a6ecaab218ab717c05835" "checksum rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "2791d88c6defac799c3f20d74f094ca33b9332612d9aef9078519c82e4fe04a5" "checksum regex 0.1.80 (registry+https://github.com/rust-lang/crates.io-index)" = "4fd4ace6a8cf7860714a2c2280d6c1f7e6a413486c13298bbc86fd3da019402f" "checksum regex-syntax 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "f9ec002c35e86791825ed294b50008eea9ddfc8def4420124fbc6b08db834957" diff --git a/Cargo.toml b/Cargo.toml index ca32cb1..55299c2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,7 +19,7 @@ globset = "0.1" lazy_static = "0.2.1" libc = "0.2.16" log = "0.3.6" -notify = "2.6.3" +notify = "3.0.0" [dev-dependencies] mktemp = "0.3.1" diff --git a/src/watcher.rs b/src/watcher.rs index ec9b6c3..1c5a926 100644 --- a/src/watcher.rs +++ b/src/watcher.rs @@ -1,7 +1,7 @@ use std::path::Path; use std::sync::mpsc::Sender; -use notify::{PollWatcher, RecommendedWatcher}; +use notify::{PollWatcher, RecommendedWatcher, RecursiveMode, raw_watcher}; /// Thin wrapper over the notify crate /// @@ -13,7 +13,7 @@ pub struct Watcher { watcher_impl: WatcherImpl, } -pub use notify::Event; +pub use notify::RawEvent as Event; pub use notify::Error; enum WatcherImpl { @@ -23,15 +23,13 @@ enum WatcherImpl { impl Watcher { pub fn new(tx: Sender, poll: bool, interval_ms: u32) -> Result { - use notify::Watcher; - let imp = if poll { - WatcherImpl::Poll(try!(PollWatcher::with_delay(tx, interval_ms))) + WatcherImpl::Poll(try!(PollWatcher::with_delay_ms(tx, interval_ms))) } else { - WatcherImpl::Recommended(try!(RecommendedWatcher::new(tx))) + WatcherImpl::Recommended(try!(raw_watcher(tx))) }; - Ok(self::Watcher { watcher_impl: imp }) + Ok(Watcher { watcher_impl: imp }) } pub fn is_polling(&self) -> bool { @@ -46,8 +44,8 @@ impl Watcher { use notify::Watcher; match self.watcher_impl { - WatcherImpl::Recommended(ref mut w) => w.watch(path), - WatcherImpl::Poll(ref mut w) => w.watch(path), + WatcherImpl::Recommended(ref mut w) => w.watch(path, RecursiveMode::Recursive), + WatcherImpl::Poll(ref mut w) => w.watch(path, RecursiveMode::Recursive), } } }