Skip to content

Commit

Permalink
922: Unwatching and rewatching as try_save does a rename of path.
Browse files Browse the repository at this point in the history
  • Loading branch information
sjoshid committed Nov 24, 2018
1 parent 7355162 commit 1eb59fd
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions rust/core-lib/src/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
}
Expand Down

0 comments on commit 1eb59fd

Please sign in to comment.