fix(about): deduplicate disks when calc disk capacity
This commit is contained in:
parent
fbd9e231d3
commit
eb6ebb70cd
1 changed files with 6 additions and 1 deletions
|
|
@ -2,7 +2,7 @@
|
||||||
// SPDX-License-Identifier: GPL-3.0-only
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
|
||||||
use bumpalo::Bump;
|
use bumpalo::Bump;
|
||||||
use std::{ffi::OsStr, io::Read};
|
use std::{collections::HashSet, ffi::OsStr, io::Read};
|
||||||
|
|
||||||
use concat_in_place::strcat;
|
use concat_in_place::strcat;
|
||||||
use const_format::concatcp;
|
use const_format::concatcp;
|
||||||
|
|
@ -53,7 +53,12 @@ impl Info {
|
||||||
sys.refresh_memory();
|
sys.refresh_memory();
|
||||||
|
|
||||||
let mut total_capacity = 0;
|
let mut total_capacity = 0;
|
||||||
|
let mut disk_set = HashSet::new();
|
||||||
for disk in disks.list() {
|
for disk in disks.list() {
|
||||||
|
if disk_set.contains(disk.name()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
disk_set.insert(disk.name());
|
||||||
total_capacity += disk.total_space();
|
total_capacity += disk.total_space();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue