Refine VFS watch behavior to support recursive watching

- Updated the `read_raw` method in `VfsInner` to ensure that the file watching behavior is only triggered when both `watch_enabled` and `watch_recursive` are true. This change enhances the control over file watching, particularly in scenarios involving nested directories.

These modifications aim to improve the efficiency and accuracy of the VFS's file watching capabilities.
This commit is contained in:
Joe 2026-03-06 17:43:08 -06:00
parent 02638535ec
commit 9ddd9379ab

View file

@ -179,7 +179,7 @@ impl VfsInner {
fn read_raw(&mut self, path: &Path) -> io::Result<Vec<u8>> {
if let Some(cache) = &mut self.prefetch_cache {
if let Some(contents) = cache.files.remove(path) {
if self.watch_enabled {
if self.watch_enabled && self.watch_recursive {
self.watch_or_record(path)?;
}
return Ok(contents);
@ -188,7 +188,7 @@ impl VfsInner {
let contents = self.backend.read(path)?;
if self.watch_enabled {
if self.watch_enabled && self.watch_recursive {
self.watch_or_record(path)?;
}