Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.
Swift cache-cleanercleanerclideveloper-toolsdisk-cleanupdisk-spaceduplicate-finderhomebrewliquid-glassmac-cleanermacosmacos-appmacos-golden-gatemacos-tahoemacos-tweaksswiftswiftuiterminal-themesuninstalluninstaller
Look inside each orphan once for the exclusions
Țugui Dragoș1ca005307d7a
diff --git a/Packages/PeelCore/Sources/PeelCore/Orphans/OrphanScanner.swift b/Packages/PeelCore/Sources/PeelCore/Orphans/OrphanScanner.swiftindex 8c69cce2..5096a6f8 100644--- a/Packages/PeelCore/Sources/PeelCore/Orphans/OrphanScanner.swift+++ b/Packages/PeelCore/Sources/PeelCore/Orphans/OrphanScanner.swift@@ -147,11 +147,13 @@ public struct OrphanScanner: Sendable {uniquingKeysWith: { first, _ in first })let folders = manifestFolders- let kept = found.filter {- !exclusions.excludes($0.item.url) && !exclusions.holds($0.item.url)- && !exclusions.excludes(bundleIdentifier: $0.identifier)- && !(owners[$0.identifier.lowercased()].map { here.contains($0.lowercased()) } ?? false)- && !Self.servesAProgram($0.item.url, in: folders)+ let kept = found.compactMap { entry -> (identifier: String, item: OrphanItem, holds: Bool?)? in+ guard !exclusions.excludes(entry.item.url), !exclusions.excludes(bundleIdentifier: entry.identifier),+ !(owners[entry.identifier.lowercased()].map { here.contains($0.lowercased()) } ?? false),+ !Self.servesAProgram(entry.item.url, in: folders)+ else { return nil }+ let holds = exclusions.holdsSomething(entry.item.url)+ return holds == true ? nil : (entry.identifier, entry.item, holds)}.map { entry invar item = entry.item@@ -166,7 +168,7 @@ public struct OrphanScanner: Sendable {item.heldBack = .signInPlugInreturn (entry.identifier, item)}- if item.leftAlone == nil, exclusions.holdBack(for: item.url) == .couldNotLookInside {+ if item.leftAlone == nil, entry.holds == nil {item.heldBack = .couldNotLookInside}return (entry.identifier, Self.holdingBack(item, beyond: reach))diff --git a/Packages/PeelCore/Tests/PeelCoreTests/OrphanScannerTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/OrphanScannerTests.swiftindex c8f01bed..15c1b209 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/OrphanScannerTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/OrphanScannerTests.swift@@ -600,6 +600,24 @@ struct OrphanScannerTests {#expect(item.heldBack == .couldNotLookInside)}+ @Test func leavesOutAFolderHoldingAnExcludedApp() async throws {+ let directory = try TemporaryDirectory()+ try directory.file("home/Library/Application Support/com.gone.app/kept/org.example.excluded/state.db")+ try directory.file("home/Library/Application Support/com.gone.other/state.db")+ let environment = SearchEnvironment(+ homeDirectory: directory.url.appending(path: "home", directoryHint: .isDirectory),+ rootDirectory: directory.url.appending(path: "root", directoryHint: .isDirectory)+ )+ let scanner = OrphanScanner(+ environment: environment, exclusions: Exclusions(bundleIdentifiers: ["org.example.excluded"]),+ isRegisteredApp: { _ in false }+ )++ let items = await scanner.scan(installedApps: installed).groups.flatMap(\.items)++ #expect(items.map(\.url.lastPathComponent) == ["com.gone.other"])+ }+/// A reason that keeps a folder where it is outranks what the walk saw, which only leaves it to be chosen.@Test func whatKeepsAFolderInPlaceOutranksWhatTheWalkSaw() async throws {let directory = try TemporaryDirectory()