mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-21 23:01:05 +00:00
refactor: make partition heuristic predicate a positive match (#3526)
This commit is contained in:
parent
c9327ca851
commit
30ac041d9e
2 changed files with 4 additions and 2 deletions
|
|
@ -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]
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue