diff --git a/tools/viewer/main.rs b/tools/viewer/main.rs index 5f8a234a1f7..356e47dad88 100644 --- a/tools/viewer/main.rs +++ b/tools/viewer/main.rs @@ -190,6 +190,16 @@ fn init_compiler( .unwrap_or_else(|err| { eprintln!("Warning: error while watching {}: {:?}", args.path.display(), err) }); + // Watch the parent directory incase args.path is renamed or removed + let parent = args.path.parent().unwrap(); + notify::Watcher::watch( + &mut *watcher.lock().unwrap(), + &parent, + notify::RecursiveMode::NonRecursive, + ) + .unwrap_or_else(|err| { + eprintln!("Warning: error while watching {}: {:?}", parent.display(), err) + }); if let Some(data_path) = &args.load_data { notify::Watcher::watch( &mut *watcher.lock().unwrap(),