From 1eb59fdf36efe59d10a0b242d9c2bf1a240b7500 Mon Sep 17 00:00:00 2001 From: Sugs Date: Sat, 24 Nov 2018 13:13:06 -0500 Subject: [PATCH] 922: Unwatching and rewatching as try_save does a rename of path. --- rust/core-lib/src/file.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rust/core-lib/src/file.rs b/rust/core-lib/src/file.rs index 31bdad5af..6d61ae004 100644 --- a/rust/core-lib/src/file.rs +++ b/rust/core-lib/src/file.rs @@ -210,8 +210,12 @@ impl FileManager { return Err(FileError::HasChanged(path.to_owned())); } else { let encoding = self.file_info[&id].encoding; + #[cfg(feature = "notify")] + self.watcher.unwatch(&path, OPEN_FILE_EVENT_TOKEN); try_save(path, text, encoding).map_err(|e| FileError::Io(e, path.to_owned()))?; self.file_info.get_mut(&id).unwrap().mod_time = get_mod_time(path); + #[cfg(feature = "notify")] + self.watcher.watch(&path,false,OPEN_FILE_EVENT_TOKEN); } Ok(()) }