mirror of
https://github.com/nushell/nushell.git
synced 2024-11-23 00:43:33 +01:00
Count the size of the directories when calculating the size in DirInfo (#3902)
* take dir entry size into consideration when calculting the size of a directory in DirInfo * fmt check
This commit is contained in:
parent
38848082ae
commit
c9b87c4c03
@ -95,6 +95,14 @@ impl DirInfo {
|
||||
path,
|
||||
};
|
||||
|
||||
match std::fs::metadata(&s.path) {
|
||||
Ok(d) => {
|
||||
s.size = d.len(); // dir entry size
|
||||
s.blocks = file_real_size_fast(&s.path, &d).ok().unwrap_or(0);
|
||||
}
|
||||
Err(e) => s = s.add_error(e.into()),
|
||||
};
|
||||
|
||||
match std::fs::read_dir(&s.path) {
|
||||
Ok(d) => {
|
||||
for f in d {
|
||||
|
Loading…
Reference in New Issue
Block a user