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
Recommend nothing in an orphan group something may still use
Țugui Dragoș3842f1a5592c
diff --git a/Packages/PeelCore/Sources/PeelCore/Orphans/Orphan.swift b/Packages/PeelCore/Sources/PeelCore/Orphans/Orphan.swiftindex 6712926a..e382bcff 100644--- a/Packages/PeelCore/Sources/PeelCore/Orphans/Orphan.swift+++ b/Packages/PeelCore/Sources/PeelCore/Orphans/Orphan.swift@@ -33,8 +33,8 @@ public struct OrphanGroup: Sendable, Hashable, Identifiable {public let items: [OrphanItem]/// The app these files belonged to, when Peel saw it installed before it went away.public var rememberedApp: RememberedApp?- /// How sure Peel is that nothing uses these files anymore. It changes how the row reads and where it is- /// listed, never what is selected: orphaned files are never selected for the user.+ /// How sure Peel is that nothing uses these files anymore. It changes how the row reads, where it is listed+ /// and whether Peel recommends the files, never what is selected: orphaned files are never selected for the user.public var confidence = OrphanConfidence(level: .likely, reasons: [.nothingClaimsIt])public var id: String { identifier }@@ -57,14 +57,14 @@ public struct OrphanGroup: Sendable, Hashable, Identifiable {items.compactMap(\.modificationDate).max()}- /// Peel recommends no row it held back: such a row waits to be chosen by hand, as Review Before Removing does on- /// an app's page.+ /// Peel recommends no row it held back, and nothing in a group something may still use: such rows wait to be+ /// chosen by hand, as Review Before Removing does on an app's page.public func selectableRows(canUseHelper: Bool) -> SelectableRows<URL> {let unlocked = items.filter { !$0.isLocked(canUseHelper: canUseHelper) }return SelectableRows(rows: items.map(\.url),selectable: unlocked.filter { $0.leftAlone == nil }.map(\.url),- recommended: unlocked.filter { $0.heldBack == nil }.map(\.url)+ recommended: confidence.level == .unsure ? [] : unlocked.filter { $0.heldBack == nil }.map(\.url))}}diff --git a/Packages/PeelCore/Sources/PeelCore/Orphans/OrphanConfidence.swift b/Packages/PeelCore/Sources/PeelCore/Orphans/OrphanConfidence.swiftindex 161ccd1e..eae6c286 100644--- a/Packages/PeelCore/Sources/PeelCore/Orphans/OrphanConfidence.swift+++ b/Packages/PeelCore/Sources/PeelCore/Orphans/OrphanConfidence.swift@@ -3,7 +3,7 @@ public import Foundation/// How sure Peel is that nothing uses a group of orphaned files anymore, and why.////// It never changes what Peel offers: orphaned files are never selected for the user, whatever this says. It-/// only decides how a row reads and which rows are listed first.+/// decides how a row reads, which rows are listed first, and that Peel recommends nothing in a group it is unsure of.public struct OrphanConfidence: Sendable, Hashable {public enum Level: Int, Sendable, Hashable, Comparable {/// Something may still use the files: it is running, it wrote here recently or after the app was gone, ordiff --git a/Packages/PeelCore/Tests/PeelCoreTests/SelectableRowsTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/SelectableRowsTests.swiftindex ca2034f5..a13808f6 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/SelectableRowsTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/SelectableRowsTests.swift@@ -94,6 +94,18 @@ struct SelectableRowsTests {#expect(!refused.isLocked(canUseHelper: false))}+ @Test func anOrphanGroupPeelIsUnsureAboutRecommendsNothing() {+ let cache = OrphanItem(+ url: URL(filePath: "/tmp/org.example.Running"), kind: .caches, size: 10, modificationDate: nil,+ requiresPrivileges: false+ )+ var group = OrphanGroup(identifier: "org.example.Running", items: [cache])+ group.confidence = OrphanConfidence(level: .unsure, reasons: [.running])++ #expect(group.selectableRows(canUseHelper: true).selectable == [cache.url])+ #expect(group.selectableRows(canUseHelper: true).recommended.isEmpty)+ }+@Test func aDeveloperToolRecommendsWhatItSelectsForThePerson() {func location(_ name: String, _ kind: DeveloperEnvironment.ContentKind, size: Int64? = 10