diff --git a/yazi-fs/src/mounts/partition.rs b/yazi-fs/src/mounts/partition.rs index e7721f69..ccbab9da 100644 --- a/yazi-fs/src/mounts/partition.rs +++ b/yazi-fs/src/mounts/partition.rs @@ -14,11 +14,18 @@ pub struct Partition { } impl Partition { - // Match mount types that do not reliably emit change notifications, or do not - // update directory metadata on changes, and should be refreshed frequently. - pub fn heuristic(&self) -> bool { + // Match mount types that do not update directory mtime on changes, + // and should be refreshed frequently. + pub fn timeless(&self) -> bool { let b: &[u8] = self.fstype.as_ref().map_or(b"", |s| s.as_encoded_bytes()); - matches!(b, b"exfat" | b"fuse.rclone") + matches!(b, b"exfat") + } + + // Match mount types that do not reliably emit change notifications, + // and should be polled for changes. + pub fn soundless(&self) -> bool { + let b: &[u8] = self.fstype.as_ref().map_or(b"", |s| s.as_encoded_bytes()); + matches!(b, b"fuse.rclone") } #[rustfmt::skip] diff --git a/yazi-fs/src/mounts/partitions.rs b/yazi-fs/src/mounts/partitions.rs index 032ef220..dde393f3 100644 --- a/yazi-fs/src/mounts/partitions.rs +++ b/yazi-fs/src/mounts/partitions.rs @@ -31,14 +31,26 @@ impl Partitions { self.inner.iter().find(|p| p.rdev == Some(dev)) } - pub fn heuristic(&self, _cha: Cha) -> bool { + pub fn timeless(&self, _cha: Cha) -> bool { #[cfg(any(target_os = "linux", target_os = "macos"))] { - self.by_dev(_cha.dev).is_some_and(|p| p.heuristic()) + self.by_dev(_cha.dev).is_some_and(|p| p.timeless()) } #[cfg(not(any(target_os = "linux", target_os = "macos")))] { - // For now, assume other targets update directory stat data correctly + // For now, assume other targets update directory mtime correctly + false + } + } + + pub fn soundless(&self, _cha: Cha) -> bool { + #[cfg(any(target_os = "linux", target_os = "macos"))] + { + self.by_dev(_cha.dev).is_some_and(|p| p.soundless()) + } + #[cfg(not(any(target_os = "linux", target_os = "macos")))] + { + // For now, assume other targets emit change notifications correctly false } } diff --git a/yazi-vfs/src/files.rs b/yazi-vfs/src/files.rs index 7440888d..726cb90a 100644 --- a/yazi-vfs/src/files.rs +++ b/yazi-vfs/src/files.rs @@ -70,7 +70,7 @@ impl VfsFiles for Files { use std::io::ErrorKind; match Cha::from_url(dir).await { Ok(c) if !c.is_dir() => FilesOp::issue_error(dir, ErrorKind::NotADirectory).await, - Ok(c) if c.hits(cha) && !PARTITIONS.read().heuristic(cha) => {} + Ok(c) if c.hits(cha) && !PARTITIONS.read().timeless(cha) => {} Ok(c) => return Some(c), Err(e) => FilesOp::issue_error(dir, e).await, } diff --git a/yazi-watcher/src/local/local.rs b/yazi-watcher/src/local/local.rs index 665691b4..56a08c1f 100644 --- a/yazi-watcher/src/local/local.rs +++ b/yazi-watcher/src/local/local.rs @@ -74,13 +74,13 @@ impl Local { } } - pub(crate) fn heuristic(path: &Path) -> bool { + pub(crate) fn soundless(path: &Path) -> bool { if cfg!(target_os = "netbsd") || yazi_adapter::WSL.get() { return true; } let Ok(meta) = path.metadata() else { return true }; - PARTITIONS.read().heuristic(Cha::new(path.file_name().unwrap_or_default(), meta)) + PARTITIONS.read().soundless(Cha::new(path.file_name().unwrap_or_default(), meta)) } async fn changed(rx: UnboundedReceiver) { diff --git a/yazi-watcher/src/watchee.rs b/yazi-watcher/src/watchee.rs index abb9bda5..bcb14f9b 100644 --- a/yazi-watcher/src/watchee.rs +++ b/yazi-watcher/src/watchee.rs @@ -40,7 +40,7 @@ impl<'a> Watchee<'a> { { let url = url.into(); if let Some(path) = url.as_local() { - let b = Local::heuristic(path); + let b = Local::soundless(path); Self::Local(url, b) } else { Self::Remote(url)