mirror of
https://github.com/nushell/nushell
synced 2024-11-15 01:17:07 +00: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
1 changed files with 8 additions and 0 deletions
|
@ -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 a new issue