From 30ac041d9e9a42f9157d279300c694a2b1ed6ad8 Mon Sep 17 00:00:00 2001 From: Gabriel Wicke Date: Wed, 7 Jan 2026 10:25:50 -0800 Subject: [PATCH] refactor: make partition heuristic predicate a positive match (#3526) --- yazi-fs/src/mounts/partition.rs | 4 +++- yazi-vfs/src/files.rs | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/yazi-fs/src/mounts/partition.rs b/yazi-fs/src/mounts/partition.rs index 9ba45b6f..05eaf77b 100644 --- a/yazi-fs/src/mounts/partition.rs +++ b/yazi-fs/src/mounts/partition.rs @@ -14,9 +14,11 @@ pub struct Partition { } impl Partition { + // Match mount types that do not reliably emit change notifications, or update directory + // metadata on changes, and should be refreshed frequently / heuristically. pub fn heuristic(&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" | b"fuse.rclone") } #[rustfmt::skip] diff --git a/yazi-vfs/src/files.rs b/yazi-vfs/src/files.rs index ed57afdf..7440888d 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().heuristic(cha) => {} Ok(c) => return Some(c), Err(e) => FilesOp::issue_error(dir, e).await, }