Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jacksongoode committed Oct 19, 2024
1 parent a102957 commit 935690b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions psst-gui/src/data/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,13 +283,13 @@ impl Default for SortCriteria {
}

fn get_dir_size(path: &Path) -> Option<u64> {
fs::read_dir(path).ok()?.fold(Some(0), |acc, entry| {
fs::read_dir(path).ok()?.try_fold(0, |acc, entry| {
let entry = entry.ok()?;
let size = if entry.file_type().ok()?.is_dir() {
get_dir_size(&entry.path())?
} else {
entry.metadata().ok()?.len()
};
acc.map(|total| total + size)
Some(acc + size)
})
}

0 comments on commit 935690b

Please sign in to comment.