-
-
Notifications
You must be signed in to change notification settings - Fork 258
Add windows ReadDirectoryChanges support #39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
f24f3fe
79b8785
d92ea4d
1592724
124652c
be214c8
1764e37
8d2167f
12f0ae4
108e08c
549da9f
7e3ead6
8f00aa1
c536e64
34b9c75
672072a
6c658c6
3c309b7
e6434a4
02bca44
7dc1f55
ad5e274
99a6fde
506de31
e717093
50af1c6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,13 +6,14 @@ authors = [ | |
| "Antti Keränen <[email protected]>", | ||
| "Gilbert Röhrbein <[email protected]>", | ||
| "Jorge Israel Peña <[email protected]>", | ||
| "Michael Maurizi <mmaurizi@azavea.com>", | ||
| "Michael Maurizi <michael.maurizi@gmail.com>", | ||
| "Pierre Baillet <[email protected]>", | ||
| "ShuYu Wang <[email protected]>", | ||
| "Jimmy Lu <[email protected]>", | ||
| "Francisco Giordano <[email protected]>", | ||
| "Jake Kerr", | ||
| "Ty Overby <[email protected]>", | ||
| "John Quigley <[email protected]>" | ||
| ] | ||
|
|
||
| description = "Cross-platform filesystem notification library" | ||
|
|
@@ -45,6 +46,18 @@ version = "^0.2.11" | |
| [target.x86_64-apple-darwin.dependencies.fsevent-sys] | ||
| version = "^0.1" | ||
|
|
||
| [target.i686-pc-windows-gnu] | ||
| dependencies = { winapi = "0.2", kernel32-sys = "0.2.1" } | ||
|
|
||
| [target.x86_64-pc-windows-gnu] | ||
| dependencies = { winapi = "0.2", kernel32-sys = "0.2.1" } | ||
|
|
||
| [target.i686-pc-windows-msvc] | ||
| dependencies = { winapi = "0.2", kernel32-sys = "0.2.1" } | ||
|
|
||
| [target.x86_64-pc-windows-msvc] | ||
| dependencies = { winapi = "0.2", kernel32-sys = "0.2.1" } | ||
|
|
||
| [dev-dependencies] | ||
| tempfile = "^1.1.0" | ||
| tempdir = "^0.3.4" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| environment: | ||
| matrix: | ||
| - TARGET: x86_64-pc-windows-msvc | ||
| - TARGET: i686-pc-windows-msvc | ||
| # skip the gnu targets to reduce build time | ||
| #- TARGET: x86_64-pc-windows-gnu | ||
| #- TARGET: i686-pc-windows-gnu | ||
| install: | ||
| - ps: Start-FileDownload "https://static.rust-lang.org/dist/rust-nightly-${env:TARGET}.exe" | ||
| - rust-nightly-%TARGET%.exe /VERYSILENT /NORESTART /DIR="C:\Program Files (x86)\Rust" | ||
| - SET PATH=%PATH%;C:\Program Files (x86)\Rust\bin | ||
| - SET PATH=%PATH%;C:\MinGW\bin | ||
| - rustc -V | ||
| - cargo -V | ||
|
|
||
| build: false | ||
|
|
||
| test_script: | ||
| - cargo test --verbose | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we add a badge to the readme for this?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can add the badge, but I think it will be broken until you set up the project there.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've just added it, so it should work :)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see the CI build, but there is a project ID that I can't see that is needed to add the badge. So I guess you'll have to add it :( Also if you like, you can remove #4 from the todo list on the readme.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will do :) |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| #[macro_use] extern crate log; | ||
| #[macro_use] extern crate bitflags; | ||
| #[cfg(target_os="macos")] extern crate fsevent_sys; | ||
| #[cfg(target_os="windows")] extern crate winapi; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this both here and in
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I removed the one from windows.rs |
||
| extern crate libc; | ||
| extern crate filetime; | ||
|
|
||
|
|
@@ -12,11 +13,13 @@ use std::convert::AsRef; | |
|
|
||
| #[cfg(target_os="macos")] pub use self::fsevent::FsEventWatcher; | ||
| #[cfg(target_os="linux")] pub use self::inotify::INotifyWatcher; | ||
| #[cfg(target_os="windows")] pub use self::windows::ReadDirectoryChangesWatcher; | ||
| pub use self::null::NullWatcher; | ||
| pub use self::poll::PollWatcher; | ||
|
|
||
| #[cfg(target_os="linux")] pub mod inotify; | ||
| #[cfg(target_os="macos")] pub mod fsevent; | ||
| #[cfg(target_os="windows")] pub mod windows; | ||
| pub mod null; | ||
| pub mod poll; | ||
|
|
||
|
|
@@ -57,7 +60,8 @@ pub trait Watcher: Sized { | |
|
|
||
| #[cfg(target_os = "linux")] pub type RecommendedWatcher = INotifyWatcher; | ||
| #[cfg(target_os = "macos")] pub type RecommendedWatcher = FsEventWatcher; | ||
| #[cfg(not(any(target_os = "linux", target_os = "macos")))] pub type RecommendedWatcher = PollWatcher; | ||
| #[cfg(target_os = "windows")] pub type RecommendedWatcher = ReadDirectoryChangesWatcher; | ||
| #[cfg(not(any(target_os = "linux", target_os = "macos", target_os = "windows")))] pub type RecommendedWatcher = PollWatcher; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is becoming a bit cumbersome... if anyone has an idea to make it so that we don't have to add to the attribute each time, please have a go :) |
||
|
|
||
| pub fn new(tx: Sender<Event>) -> Result<RecommendedWatcher, Error> { | ||
| Watcher::new(tx) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add yourself in there, too :)