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.

A reset checks again that the app is closed right before it moves

Țugui Dragoșf39face837f5
diff --git a/Peel/Model/ResetPlan.swift b/Peel/Model/ResetPlan.swift
index ee2bb36c..5d3e16f0 100644
--- a/Peel/Model/ResetPlan.swift
+++ b/Peel/Model/ResetPlan.swift
@@ -81,8 +81,9 @@ final class ResetPlan {
}
/// Backs up the app's settings, then moves the selection to the Trash, which also makes cfprefsd forget the
- /// app's preference domains. Checks again that the app is not running: an app opened since the sheet
- /// appeared would have its files moved from under it, and would write its settings back when it quits.
+ /// app's preference domains. Checks that the app is not running before the copy and again before the move,
+ /// since the copy takes a moment: an app opened meanwhile would have its files moved from under it, and would
+ /// write its settings back when it quits. Then nothing moves, and the copy stays.
func performReset() async -> TrashResult {
refreshRunningState()
guard let reset, !isAppRunning else { return TrashResult() }
@@ -100,6 +101,8 @@ final class ResetPlan {
backup = nil
}
couldNotSaveSettings = false
+ refreshRunningState()
+ guard !isAppRunning else { return TrashResult() }
let result = await TrashService(exclusions: ExclusionsStore.shared.exclusions).trash(urls, ownedBy: app.bundleIdentifier)
failures = result.failures
movedCount = result.trashed.count