From bcb38f97d0ac7855a5cbffa35376be5ee74aacce Mon Sep 17 00:00:00 2001 From: jasta Date: Thu, 31 Mar 2022 16:14:49 -0700 Subject: [PATCH] Fixed windows compilation of poll_sysfs example --- examples/poll_sysfs.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/examples/poll_sysfs.rs b/examples/poll_sysfs.rs index 6ced0edd..28d80a2c 100644 --- a/examples/poll_sysfs.rs +++ b/examples/poll_sysfs.rs @@ -1,11 +1,10 @@ -#![cfg(not(target_os = "windows"))] - use std::path::Path; use std::time::Duration; use notify::poll::PollWatcherConfig; use notify::{PollWatcher, RecursiveMode, Watcher}; -fn main() -> notify::Result<()> { +#[cfg(not(target_os = "windows"))] +fn not_windows_main() -> notify::Result<()> { let mut paths: Vec<_> = std::env::args().skip(1) .map(|arg| Path::new(&arg).to_path_buf()) .collect(); @@ -40,3 +39,10 @@ fn main() -> notify::Result<()> { Ok(()) } + +fn main() -> notify::Result<()> { + #[cfg(not(target_os = "windows"))] + { + not_windows_main() + } +} \ No newline at end of file