mirror of
https://github.com/tw93/Mole.git
synced 2026-03-22 18:30:08 +00:00
fix(status): prefer internal disks over external in disk listing
When multiple disks are connected, the status command was sorting only by size, causing external disks to appear first when they are larger than the internal disk. This resulted in showing incorrect free space (external disk size) instead of the internal disk. The sort now prioritizes internal disks before sorting by size, ensuring the internal disk always appears first. Fixes #466
This commit is contained in:
@@ -82,6 +82,11 @@ func collectDisks() ([]DiskStatus, error) {
|
|||||||
annotateDiskTypes(disks)
|
annotateDiskTypes(disks)
|
||||||
|
|
||||||
sort.Slice(disks, func(i, j int) bool {
|
sort.Slice(disks, func(i, j int) bool {
|
||||||
|
// First, prefer internal disks over external
|
||||||
|
if disks[i].External != disks[j].External {
|
||||||
|
return !disks[i].External
|
||||||
|
}
|
||||||
|
// Then sort by size (largest first)
|
||||||
return disks[i].Total > disks[j].Total
|
return disks[i].Total > disks[j].Total
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user