mirror of
https://github.com/lsd-rs/lsd
synced 2025-03-05 07:27:20 +00:00
do not calculate total directory size unless it will be displayed
This commit is contained in:
parent
23a11de5df
commit
dd2ef0aad6
2 changed files with 6 additions and 1 deletions
|
@ -124,7 +124,8 @@ impl Core {
|
||||||
meta_list.push(meta);
|
meta_list.push(meta);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if self.flags.total_size.0 {
|
// Only calculate the total size of a directory if it will be displayed
|
||||||
|
if self.flags.total_size.0 && self.flags.blocks.displays_size() {
|
||||||
for meta in &mut meta_list.iter_mut() {
|
for meta in &mut meta_list.iter_mut() {
|
||||||
meta.calculate_total_size();
|
meta.calculate_total_size();
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,6 +151,10 @@ impl Blocks {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn displays_size(&self) -> bool {
|
||||||
|
self.0.contains(&Block::Size)
|
||||||
|
}
|
||||||
|
|
||||||
/// Tnserts a [Block] of variant [INode](Block::Context), if `self` does not already contain a
|
/// Tnserts a [Block] of variant [INode](Block::Context), if `self` does not already contain a
|
||||||
/// [Block] of that variant. The positioning will be best-effort approximation of coreutils
|
/// [Block] of that variant. The positioning will be best-effort approximation of coreutils
|
||||||
/// ls position for a security context
|
/// ls position for a security context
|
||||||
|
|
Loading…
Add table
Reference in a new issue