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
A leftover the guard will refuse says so even when it could not be read
Țugui Dragoș4a6aebb2421a
diff --git a/Packages/PeelCore/Sources/PeelCore/Leftovers/LeftoverScanner.swift b/Packages/PeelCore/Sources/PeelCore/Leftovers/LeftoverScanner.swiftindex 176b070b..f1eb3b0f 100644--- a/Packages/PeelCore/Sources/PeelCore/Leftovers/LeftoverScanner.swift+++ b/Packages/PeelCore/Sources/PeelCore/Leftovers/LeftoverScanner.swift@@ -217,18 +217,18 @@ public struct LeftoverScanner: Sendable {// A folder that did not answer in time is unknown, not empty: it may hold a repository, and the largest// folders are the ones that run out of time.let contents = await measure(url)- // Where a protected key lies is known from the path alone, so that reason comes first. A folder macOS- // refuses to open would read as empty, and an empty folder of the app's own would be selected. From- // macOS 27, another team's container is refused outright rather than prompted for.+ // What the guard will refuse comes first, whatever the walk saw. A folder macOS refuses to open would read+ // as empty, and an empty folder of the app's own would be selected. From macOS 27, another team's container+ // is refused outright rather than prompted for.let heldBack: HoldBack? = if ProtectedData.holds(url.path(percentEncoded: false), home: home)|| ProtectedData.holdsABrowserWallet(url.path(percentEncoded: false)) {.holdsKeys- } else if contents?.couldNotBeRead == true {- .couldNotBeRead} else if kind == .containers, ProtectedData.holdsAContainersDocuments(url.path(percentEncoded: false)) {.holdsDocuments} else if ProtectedData.holdsALibrary(url.path(percentEncoded: false)) {.holdsALibrary+ } else if contents?.couldNotBeRead == true {+ .couldNotBeRead} else if let contents {heldBack(match, in: kind, contents: contents, isInsideAnotherAppsFolder: isInsideAnotherAppsFolder)} else {diff --git a/Packages/PeelCore/Tests/PeelCoreTests/LeftoverScannerTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/LeftoverScannerTests.swiftindex e878d754..e6afea72 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/LeftoverScannerTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/LeftoverScannerTests.swift@@ -579,6 +579,31 @@ struct LeftoverScannerTests {#expect(leftover.match.heldBack == .holdsKeys)}+ /// A reason the guard will refuse the move for comes before the walk's, so a container with documents inside,+ /// or a folder around a library, reads as one that cannot be selected even when macOS would not let Peel read+ /// the folder.+ @Test func whatTheGuardWillRefuseComesBeforeAFolderThatCouldNotBeRead() async throws {+ let directory = try TemporaryDirectory()+ let container = try directory.directory("home/Library/Containers/com.example.notes")+ try directory.file("home/Library/Containers/com.example.notes/Data/Documents/novel.txt")+ let photos = try directory.directory("home/Library/Application Support/Example")+ try directory.file("home/Library/Application Support/Example/2024/Trip.photoslibrary/database/Photos.sqlite")+ let unread: LeftoverScanner.Measure = { _ in FolderContents(size: 0, holdsRepository: false, couldNotBeRead: true) }+ func leftover(_ url: URL, _ kind: SearchLocation.Kind) async -> Leftover {+ await LeftoverScanner.leftover(+ at: url,+ kind: kind,+ match: LeftoverMatch(reason: .bundleIdentifier, confidence: .certain, sharedWith: []),+ parent: ParentAccess(url.deletingLastPathComponent()),+ home: directory.url.appending(path: "home").path(percentEncoded: false),+ measure: unread+ )+ }++ #expect(await leftover(container, .containers).match.heldBack == .holdsDocuments)+ #expect(await leftover(photos, .applicationSupport).match.heldBack == .holdsALibrary)+ }+/// A browser's folder that holds a profile with a wallet extension cannot be selected either.@Test func aBrowsersFolderHoldingAWalletCannotBeSelected() async throws {let directory = try TemporaryDirectory()