mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
Polish systemic mount size handling
Agent-Logs-Url: https://github.com/sxyazi/yazi/sessions/89d44d10-de98-42c8-bc7b-dc68c41459bb Co-authored-by: sxyazi <17523360+sxyazi@users.noreply.github.com>
This commit is contained in:
parent
9711d6aa25
commit
4873b9a229
1 changed files with 6 additions and 3 deletions
|
|
@ -153,9 +153,11 @@ fn systemic_mounts_from(root: &Path, mounts: &str) -> SystemicMounts {
|
||||||
let dist = unmangle_octal(it.next()?);
|
let dist = unmangle_octal(it.next()?);
|
||||||
let fstype = unmangle_octal(it.next()?);
|
let fstype = unmangle_octal(it.next()?);
|
||||||
let dist = PathBuf::from(dist.as_ref());
|
let dist = PathBuf::from(dist.as_ref());
|
||||||
(Partition { fstype: Some(fstype.into_owned().into()), ..Default::default() }.systemic()
|
let systemic = Partition { fstype: Some(fstype.into_owned().into()), ..Default::default() }
|
||||||
&& (dist == root || dist.starts_with(root)))
|
.systemic();
|
||||||
.then_some(dist)
|
let descendant = dist == root || dist.starts_with(root);
|
||||||
|
|
||||||
|
(systemic && descendant).then_some(dist)
|
||||||
})
|
})
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
@ -165,6 +167,7 @@ fn unmangle_octal(s: &str) -> std::borrow::Cow<'_, str> {
|
||||||
use yazi_shared::replace_cow;
|
use yazi_shared::replace_cow;
|
||||||
|
|
||||||
let mut s = std::borrow::Cow::Borrowed(s);
|
let mut s = std::borrow::Cow::Borrowed(s);
|
||||||
|
// `/proc/mounts` escapes tabs, newlines, spaces, `#`, and `\` using octal sequences.
|
||||||
for (a, b) in
|
for (a, b) in
|
||||||
[(r"\011", "\t"), (r"\012", "\n"), (r"\040", " "), (r"\043", "#"), (r"\134", r"\")]
|
[(r"\011", "\t"), (r"\012", "\n"), (r"\040", " "), (r"\043", "#"), (r"\134", r"\")]
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue