Skip to content

armgit / peel

Public Imported from GitHub
0

Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.

Make Space's Rescan look again inside the areas already opened

Țugui Dragoșfb998308e8f9
diff --git a/Peel/Model/SpaceLibrary.swift b/Peel/Model/SpaceLibrary.swift
index 60ab238d..3f6abaa3 100644
--- a/Peel/Model/SpaceLibrary.swift
+++ b/Peel/Model/SpaceLibrary.swift
@@ -26,6 +26,12 @@ final class SpaceLibrary: RowSelection {
await refresh(replanning: [])
}
+ /// Scans again and makes every area's plan again, as Rescan asks: a plan also depends on which apps are open,
+ /// which the area's size does not show.
+ func rescan() async {
+ await refresh(replanning: Set(plans.keys))
+ }
+
/// Makes the area's plan from what is on disk now, keeping what was chosen in it.
func plan(_ item: SpaceItem) async {
let made = await newPlan(for: item)
diff --git a/Peel/Views/Space/SpaceDetailView.swift b/Peel/Views/Space/SpaceDetailView.swift
index 8a0bd51d..88a4d3da 100644
--- a/Peel/Views/Space/SpaceDetailView.swift
+++ b/Peel/Views/Space/SpaceDetailView.swift
@@ -97,8 +97,8 @@ struct SpaceDetailView: View {
)
}
}
- // Made again each time the page opens, since what is inside changes as apps run. A rescan that finds the
- // area changed makes it again too (`SpaceLibrary.refresh`).
+ // Made again each time the page opens, since what is inside changes as apps run. Rescan makes it again too
+ // (`SpaceLibrary.rescan`), and so does a scan that finds the area changed.
.task(id: item.id) {
guard !item.isReadOnly else { return }
await space.plan(item)
diff --git a/Peel/Views/Space/SpaceList.swift b/Peel/Views/Space/SpaceList.swift
index 5c828279..17a730ce 100644
--- a/Peel/Views/Space/SpaceList.swift
+++ b/Peel/Views/Space/SpaceList.swift
@@ -86,7 +86,7 @@ struct SpaceList: View {
}
ToolbarItem {
RescanButton(isRunning: $isRescanning, isDisabled: space.isRemoving, scan: space.scanRun) {
- await space.refresh()
+ await space.rescan()
}
}
}