From d3151dfbf99e64fd5855d0e0ce5be119410ba293 Mon Sep 17 00:00:00 2001 From: Joe Wilm Date: Mon, 16 Oct 2017 18:38:57 -0700 Subject: Fix config reloading Must have been broken when upgrading notify-rs --- src/config.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/config.rs b/src/config.rs index 605a80db..eacb1c7e 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1454,12 +1454,16 @@ impl Monitor { let config_path = ::std::fs::canonicalize(path) .expect("canonicalize config path"); - watcher.watch(&config_path, RecursiveMode::NonRecursive).expect("watch alacritty yml"); + // Get directory of config + let mut parent = config_path.clone(); + parent.pop(); - loop { - let event = rx.recv().expect("watcher event"); + // Watch directory + watcher.watch(&parent, RecursiveMode::NonRecursive) + .expect("watch alacritty.yml dir"); - match event { + loop { + match rx.recv().expect("watcher event") { DebouncedEvent::Rename(_, _) => continue, DebouncedEvent::Write(path) | DebouncedEvent::Create(path) | DebouncedEvent::Chmod(path) => { -- cgit