From 5840e837eb7d0311fd1e97be6b729ef11d0f25fb Mon Sep 17 00:00:00 2001 From: Tom Gowan Date: Mon, 29 Apr 2019 15:03:43 +1000 Subject: [PATCH] use directory --- src/watch.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/watch.rs b/src/watch.rs index 83fde00..9fd593f 100644 --- a/src/watch.rs +++ b/src/watch.rs @@ -79,14 +79,16 @@ impl Drop for Handler { } fn create_watch( - vert_path: PathBuf, - frag_path: PathBuf, + mut vert_path: PathBuf, + mut frag_path: PathBuf, ) -> (Handler, mpsc::Receiver>) { let (notify_tx, notify_rx) = mpsc::channel(); let (thread_tx, thread_rx) = mpsc::channel(); let mut watcher: RecommendedWatcher = Watcher::new(notify_tx, Duration::from_millis(50)).expect("failed to create watcher"); + vert_path.pop(); + frag_path.pop(); watcher .watch(&vert_path, RecursiveMode::NonRecursive) .expect("failed to add vertex shader to notify"); @@ -101,7 +103,6 @@ fn create_watch( break 'watch_loop; } if let Ok(notify::DebouncedEvent::Create(_)) - | Ok(notify::DebouncedEvent::NoticeWrite(_)) | Ok(notify::DebouncedEvent::Write(_)) = notify_rx.recv_timeout(Duration::from_secs(1)) { loader.reload();