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
Don't call an app gone when a link leads where Peel can't look
Țugui Dragoș849e3e86e462
diff --git a/Packages/PeelCore/Sources/PeelCore/Orphans/OrphanScanner.swift b/Packages/PeelCore/Sources/PeelCore/Orphans/OrphanScanner.swiftindex d0ed1bbf..a1f2f6a7 100644--- a/Packages/PeelCore/Sources/PeelCore/Orphans/OrphanScanner.swift+++ b/Packages/PeelCore/Sources/PeelCore/Orphans/OrphanScanner.swift@@ -549,7 +549,7 @@ public struct OrphanScanner: Sendable {}/// The app bundle a link leads into, when that bundle is gone. Nil for a link into an app that is still- /// there, one on a disk that isn't connected, or into no app at all.+ /// there or may be, on a disk that isn't connected or where Peel can't look, or into no app at all.static func goneApp(behind link: URL) -> URL? {guardlet destination = try? FileManager.default.destinationOfSymbolicLink(@@ -563,8 +563,7 @@ public struct OrphanScanner: Sendable {filePath: NSString.path(withComponents: Array(components[...app])),directoryHint: .isDirectory)- guard !bundle.isOnADiskNotConnected else { return nil }- return FileManager.default.fileExists(atPath: bundle.path(percentEncoded: false)) ? nil : bundle+ return bundle.isMissing && !bundle.isOnADiskNotConnected ? bundle : nil}/// The identifier an item is listed under, or nil when it must not be listed. A link is named for its tool,diff --git a/Packages/PeelCore/Tests/PeelCoreTests/OrphanScannerTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/OrphanScannerTests.swiftindex 196531e5..646db8f6 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/OrphanScannerTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/OrphanScannerTests.swift@@ -1596,6 +1596,22 @@ struct OrphanScannerTests {#expect(scan.groups.isEmpty)}+ @Test(.permissionsHold) func aLinkIntoAnAppInAPlacePeelCannotLookIsNotListed() async throws {+ let directory = try TemporaryDirectory()+ let bin = try directory.directory("root/usr/local/bin")+ let tool = try directory.file("Closed/Closed.app/Contents/MacOS/closed")+ try FileManager.default.createSymbolicLink(+ atPath: bin.appending(path: "closed").path(percentEncoded: false),+ withDestinationPath: tool.path(percentEncoded: false)+ )+ try directory.setPermissions(0o000, of: "Closed")+ defer { try? directory.setPermissions(0o755, of: "Closed") }++ let scan = await scanner(in: directory).scan(installedApps: installed)++ #expect(scan.groups.isEmpty)+ }+/// A shell completion an app's installer linked into zsh's folder leads nowhere once the app is gone, and zsh/// then complains in every new shell. It is listed as a tool's link is.@Test func listsAShellCompletionThatLeadsIntoAnAppThatIsGone() async throws {