mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
fix: treat nfs4 mounts as soundless
Co-authored-by: sxyazi <17523360+sxyazi@users.noreply.github.com> Agent-Logs-Url: https://github.com/sxyazi/yazi/sessions/ba27f406-31b3-4aef-8352-563444281d30
This commit is contained in:
parent
9bc53da9ea
commit
5455ed2076
1 changed files with 21 additions and 1 deletions
|
|
@ -25,7 +25,7 @@ impl Partition {
|
||||||
// and should be polled for changes.
|
// and should be polled for changes.
|
||||||
pub fn soundless(&self) -> bool {
|
pub fn soundless(&self) -> bool {
|
||||||
let b: &[u8] = self.fstype.as_ref().map_or(b"", |s| s.as_encoded_bytes());
|
let b: &[u8] = self.fstype.as_ref().map_or(b"", |s| s.as_encoded_bytes());
|
||||||
matches!(b, b"fuse.rclone")
|
matches!(b, b"fuse.rclone" | b"nfs4")
|
||||||
}
|
}
|
||||||
|
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
|
|
@ -46,6 +46,26 @@ impl Partition {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::Partition;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn soundless_mount_types_include_nfs4() {
|
||||||
|
let partition =
|
||||||
|
Partition { fstype: Some("nfs4".into()), ..Default::default() };
|
||||||
|
assert!(partition.soundless());
|
||||||
|
|
||||||
|
let partition =
|
||||||
|
Partition { fstype: Some("fuse.rclone".into()), ..Default::default() };
|
||||||
|
assert!(partition.soundless());
|
||||||
|
|
||||||
|
let partition =
|
||||||
|
Partition { fstype: Some("ext4".into()), ..Default::default() };
|
||||||
|
assert!(!partition.soundless());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Partition {
|
impl Partition {
|
||||||
#[cfg(any(target_os = "linux", target_os = "macos"))]
|
#[cfg(any(target_os = "linux", target_os = "macos"))]
|
||||||
pub(super) fn new(name: &std::ffi::OsStr) -> Self {
|
pub(super) fn new(name: &std::ffi::OsStr) -> Self {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue