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.

Find what an app that left kept inside another folder

Țugui Dragoșd68907fc73f2
diff --git a/Localization/Peel/Localizable.xcstrings b/Localization/Peel/Localizable.xcstrings
index 47e69860..b693cf8c 100644
--- a/Localization/Peel/Localizable.xcstrings
+++ b/Localization/Peel/Localizable.xcstrings
@@ -146975,6 +146975,112 @@
}
}
},
+ "There are more folders in %@ than Peel looks inside, so an orphaned file may be in a folder Peel didn’t reach." : {
+ "localizations" : {
+ "cs" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "V %@ je víc složek, než kolik jich Peel prochází, takže nějaký osiřelý soubor může být ve složce, kam se Peel nedostal."
+ }
+ },
+ "de" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "In %@ gibt es mehr Ordner, als Peel durchsieht, daher liegt möglicherweise eine verwaiste Datei in einem Ordner, den Peel nicht erreicht hat."
+ }
+ },
+ "es" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "En %@ hay más carpetas de las que Peel revisa, así que puede que haya algún archivo huérfano en una carpeta a la que Peel no ha llegado."
+ }
+ },
+ "fr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Il y a plus de dossiers dans %@ que Peel n’en examine : un fichier orphelin peut donc se trouver dans un dossier que Peel n’a pas atteint."
+ }
+ },
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "In %@ ci sono più cartelle di quante Peel ne esamini, quindi un file orfano potrebbe trovarsi in una cartella che Peel non ha raggiunto."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%@にはPeelが調べる数より多くのフォルダがあるため、Peelが調べなかったフォルダに孤立ファイルがある可能性があります。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%@에 Peel이 살펴보는 것보다 많은 폴더가 있으므로, 주인 없는 파일이 Peel이 살펴보지 못한 폴더에 있을 수 있습니다."
+ }
+ },
+ "nl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Er zijn meer mappen in %@ dan Peel doorzoekt, dus er kan een verweesd bestand staan in een map die Peel niet heeft bereikt."
+ }
+ },
+ "pl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "W %@ jest więcej folderów, niż Peel przegląda, więc jakiś osierocony plik może być w folderze, do którego Peel nie dotarł."
+ }
+ },
+ "pt" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Há mais pastas em %@ do que o Peel examina, então um arquivo órfão pode estar em uma pasta que o Peel não alcançou."
+ }
+ },
+ "ro" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "În %@ sunt mai multe dosare decât examinează Peel, așa că un fișier orfan se poate afla într‑un dosar la care Peel nu a ajuns."
+ }
+ },
+ "ru" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "В %@ больше папок, чем Peel просматривает, поэтому какой-то осиротевший файл может лежать в папке, до которой Peel не добрался."
+ }
+ },
+ "sv" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Det finns fler mappar i %@ än Peel tittar i, så en övergiven fil kan ligga i en mapp som Peel inte nådde."
+ }
+ },
+ "tr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%@ içinde Peel’in içine baktığından daha fazla klasör var, bu yüzden sahipsiz bir dosya Peel’in ulaşmadığı bir klasörde olabilir."
+ }
+ },
+ "uk" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "У %@ більше папок, ніж Peel переглядає, тож покинутий файл може бути в папці, до якої Peel не дійшла."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%@中的文件夹数量超出了Peel查看的上限,因此可能有孤立文件位于Peel未查看到的文件夹中。"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%@中的檔案夾數量超出Peel查看的範圍,因此可能有孤立檔案位於Peel沒有查看到的檔案夾中。"
+ }
+ }
+ }
+ },
"There are more folders in %@ than Peel looks inside, so something of this app’s may be in a folder Peel didn’t reach." : {
"localizations" : {
"cs" : {
diff --git a/Packages/PeelCore/Sources/PeelCommandLine/Commands/FileCommands.swift b/Packages/PeelCore/Sources/PeelCommandLine/Commands/FileCommands.swift
index 3a589a34..3dabd574 100644
--- a/Packages/PeelCore/Sources/PeelCommandLine/Commands/FileCommands.swift
+++ b/Packages/PeelCore/Sources/PeelCommandLine/Commands/FileCommands.swift
@@ -101,9 +101,21 @@ struct OrphansCommand: AsyncParsableCommand {
Output.table(Self.rows(for: group), indent: " ")
}
}
+ for note in Self.notes(for: scan) {
+ Output.note(note)
+ }
+ }
+
+ /// What the list could not cover: the folders Peel could not read, and the places with more folders inside
+ /// than Peel looks into.
+ static func notes(for scan: OrphanScan) -> [String] {
+ var notes: [String] = []
if !scan.unreadableLocations.isEmpty {
let folders = scan.unreadableLocations.map(\.url)
- Output.note(Output.unreadableNote(for: folders, needsFullDiskAccess: scan.needsFullDiskAccess))
+ notes.append(Output.unreadableNote(for: folders, needsFullDiskAccess: scan.needsFullDiskAccess))
+ }
+ return notes + scan.cutShortLocations.map {
+ "There are more folders in \(Output.plain(Output.path($0.url))) than Peel looks inside, so an orphaned file may be in a folder Peel didn't reach."
}
}
diff --git a/Packages/PeelCore/Sources/PeelCore/Orphans/Orphan.swift b/Packages/PeelCore/Sources/PeelCore/Orphans/Orphan.swift
index f526de1d..63c775ba 100644
--- a/Packages/PeelCore/Sources/PeelCore/Orphans/Orphan.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Orphans/Orphan.swift
@@ -60,12 +60,15 @@ public struct OrphanScan: Sendable {
/// True when macOS's privacy protection, not ordinary permissions, kept Peel out of one of `unreadableLocations`,
/// so Full Disk Access would open it.
public var needsFullDiskAccess = false
+ /// The places with more folders inside than Peel looks into (`NestedSearch.folderLimit`), so an orphaned file
+ /// may be in one it did not reach.
+ public var cutShortLocations: [SearchLocation] = []
/// The same scan without the group `id`, as when the person said it belongs to an app.
public func without(_ id: OrphanGroup.ID) -> OrphanScan {
OrphanScan(
groups: groups.filter { $0.id != id }, unreadableLocations: unreadableLocations,
- needsFullDiskAccess: needsFullDiskAccess
+ needsFullDiskAccess: needsFullDiskAccess, cutShortLocations: cutShortLocations
)
}
}
diff --git a/Packages/PeelCore/Sources/PeelCore/Orphans/OrphanScanner.swift b/Packages/PeelCore/Sources/PeelCore/Orphans/OrphanScanner.swift
index 3635fcf6..6464a9bf 100644
--- a/Packages/PeelCore/Sources/PeelCore/Orphans/OrphanScanner.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Orphans/OrphanScanner.swift
@@ -13,6 +13,8 @@ public struct OrphanScanner: Sendable {
/// The apps that come with macOS, which can claim files like any other app. Nil means `AppCatalog.systemApps`.
private let systemApps: [InstalledApp]?
private let walk: LeftoverScanner.Measure
+ /// The most folders listed per location while looking inside folders no orphan is named after.
+ private let nestedFolderLimit: Int
public init(environment: SearchEnvironment = .current, exclusions: Exclusions = .none) {
self.init(
@@ -27,13 +29,15 @@ public struct OrphanScanner: Sendable {
exclusions: Exclusions = .none,
isRegisteredApp: @escaping @Sendable (String) -> Bool,
systemApps: [InstalledApp]? = nil,
- walk: @escaping LeftoverScanner.Measure = LeftoverScanner.walk
+ walk: @escaping LeftoverScanner.Measure = LeftoverScanner.walk,
+ nestedFolderLimit: Int = NestedSearch.folderLimit
) {
self.environment = environment
self.exclusions = exclusions
self.isRegisteredApp = isRegisteredApp
self.systemApps = systemApps
self.walk = walk
+ self.nestedFolderLimit = nestedFolderLimit
}
/// Finds the items that no app claims, in every location, grouped by identifier.
@@ -79,10 +83,11 @@ public struct OrphanScanner: Sendable {
let results = await withTaskGroup(of: LocationResult.self) { group in
let home = environment.homeDirectory.path(percentEncoded: false)
for location in environment.locations {
- _ = group.addTaskUnlessCancelled { [walk] in
+ _ = group.addTaskUnlessCancelled { [exclusions, nestedFolderLimit, walk] in
await Self.scan(
location, ownership: ownership, jobs: jobs, goneBundles: goneBundles, goneApps: goneApps,
- goneNames: goneNames, home: home, walk: walk
+ goneNames: goneNames, home: home, exclusions: exclusions, nestedFolderLimit: nestedFolderLimit,
+ walk: walk
)
}
}
@@ -91,10 +96,15 @@ public struct OrphanScanner: Sendable {
var found: [(identifier: String, item: OrphanItem)] = []
var unreadableLocations: [SearchLocation] = []
+ var cutShortLocations: [SearchLocation] = []
for result in results {
switch result {
- case .found(let items): found += items
- case .unreadable(let location): unreadableLocations.append(location)
+ case .found(let items, let cutShort, let unreadable):
+ found += items
+ unreadableLocations += unreadable
+ if let cutShort { cutShortLocations.append(cutShort) }
+ case .unreadable(let location):
+ unreadableLocations.append(location)
}
}
@@ -113,12 +123,14 @@ public struct OrphanScanner: Sendable {
return (entry.identifier, item)
}
let teams = Set(installedApps.compactMap(\.teamIdentifier))
+ let byPath: (SearchLocation, SearchLocation) -> Bool = {
+ $0.url.path(percentEncoded: false) < $1.url.path(percentEncoded: false)
+ }
return OrphanScan(
groups: Self.group(kept, remembered: gone, installedTeams: teams, running: running),
- unreadableLocations: unreadableLocations.sorted {
- $0.url.path(percentEncoded: false) < $1.url.path(percentEncoded: false)
- },
- needsFullDiskAccess: unreadableLocations.contains { FullDiskAccess.canList($0.url) == .missing }
+ unreadableLocations: unreadableLocations.sorted(by: byPath),
+ needsFullDiskAccess: unreadableLocations.contains { FullDiskAccess.canList($0.url) == .missing },
+ cutShortLocations: cutShortLocations.sorted(by: byPath)
)
}
@@ -271,12 +283,14 @@ public struct OrphanScanner: Sendable {
/// The identifier an item is listed under, or nil when it must not be listed. A link is named for its tool,
/// so it is listed under the app it leads into: the identifier Peel remembers for that path, or the app's name.
+ /// With `goneApps`, only an identifier that came with one of those apps is listed (`cameWithAnAppThatLeft`).
private static func orphanIdentifier(
of url: URL,
kind: SearchLocation.Kind,
ownership: AppOwnership,
jobs: BackgroundItemOwnership,
- goneBundles: [String: String] = [:]
+ goneBundles: [String: String] = [:],
+ cameWithOneOf goneApps: [String]? = nil
) async -> String? {
if kind == .commandLineTools {
guard let bundle = goneApp(behind: url) else { return nil }
@@ -288,6 +302,7 @@ public struct OrphanScanner: Sendable {
!isSensitive(fileName: name),
let identifier = orphanIdentifier(forKey: LeftoverMatcher.key(from: name, kind: kind), kind: kind)
?? DeclaredIdentifier.of(url, kind: kind).flatMap({ orphanIdentifier(forKey: $0, kind: kind) }),
+ goneApps.map({ cameWithAnAppThatLeft(identifier, goneApps: $0) }) ?? true,
!ownership.isClaimed(fileName: name, kind: kind, identifier: identifier),
await !holdsFilesOfAnInstalledApp(url, kind: kind, ownership: ownership),
!isStillAJob(url, kind: kind, jobs: jobs)
@@ -329,10 +344,20 @@ public struct OrphanScanner: Sendable {
}
private enum LocationResult: Sendable {
- case found([(identifier: String, item: OrphanItem)])
+ /// `cutShort` is the location itself when the search inside its folders hit the limit, and `unreadable` the
+ /// folders inside it that search could not look into.
+ case found([(identifier: String, item: OrphanItem)], cutShort: SearchLocation?, unreadable: [SearchLocation])
case unreadable(SearchLocation)
}
+ /// Something to list, waiting to be measured.
+ private struct Candidate {
+ let url: URL
+ let identifier: String
+ let namedAfter: String?
+ let parent: ParentAccess
+ }
+
private static func scan(
_ location: SearchLocation,
ownership: AppOwnership,
@@ -341,20 +366,25 @@ public struct OrphanScanner: Sendable {
goneApps: [String],
goneNames: [String: String],
home: String,
+ exclusions: Exclusions,
+ nestedFolderLimit: Int,
walk: @escaping LeftoverScanner.Measure
) async -> LocationResult {
let entries: [String]
do {
+ // Sorted, because with a limit on how many folders are looked inside, the order decides which ones.
entries = try FileManager.default.contentsOfDirectory(atPath: location.url.path(percentEncoded: false))
+ .sorted()
ScanCount.current?.add(entries.count)
} catch CocoaError.fileReadNoSuchFile {
- return .found([])
+ return .found([], cutShort: nil, unreadable: [])
} catch {
return .unreadable(location)
}
let parent = ParentAccess(location.url)
- var candidates: [(url: URL, identifier: String, namedAfter: String?)] = []
+ var candidates: [Candidate] = []
+ var nobodysFolders: [URL] = []
for name in entries where location.kind.considers(fileName: name) {
guard !Task.isCancelled else { break }
let url = location.url.appending(path: name)
@@ -367,23 +397,45 @@ public struct OrphanScanner: Sendable {
kind: location.kind,
ownership: ownership,
jobs: jobs,
- goneBundles: goneBundles
+ goneBundles: goneBundles,
+ cameWithOneOf: location.kind.isLoadedCode ? goneApps : nil
)
if identifier == nil {
namedAfter = await goneApp(named: url, kind: location.kind, goneNames: goneNames, ownership: ownership)
identifier = namedAfter
}
- guard let identifier else { continue }
- guard !location.kind.isLoadedCode || cameWithAnAppThatLeft(identifier, goneApps: goneApps) else { continue }
- candidates.append((url, identifier, namedAfter))
+ if let identifier {
+ candidates.append(Candidate(url: url, identifier: identifier, namedAfter: namedAfter, parent: parent))
+ } else if NestedSearch.kinds.contains(location.kind), url.isRealFolder, !exclusions.excludes(url) {
+ nobodysFolders.append(url)
+ }
}
+ // Inside those folders a dotted name is as often a file's own (a lock, a backup, an editor's extension) as
+ // an app's identifier, so only what came with an app Peel saw go is listed there.
+ let inside: NestedSearch.Findings<Candidate> = await NestedSearch.walk(
+ inside: nobodysFolders,
+ limit: nestedFolderLimit
+ ) { url, _, parent, canLookInside in
+ guard isAFileAFolderOrALink(url), !ProtectedData.refuses(url.path(percentEncoded: false), home: home),
+ !exclusions.excludes(url)
+ else { return .pass }
+ if let identifier = await orphanIdentifier(
+ of: url, kind: location.kind, ownership: ownership, jobs: jobs, cameWithOneOf: goneApps
+ ) {
+ return .take(Candidate(url: url, identifier: identifier, namedAfter: nil, parent: parent))
+ }
+ return canLookInside && url.isRealFolder ? .lookInside : .pass
+ }
+ candidates += inside.found
+
// A few walks at a time, so a few folders that never answer do not each hold the location for a whole budget.
let walked = await candidates.map(\.url).concurrentMap(width: LeftoverScanner.concurrentMeasurements) {
await walk($0)
}
var found: [(identifier: String, item: OrphanItem)] = []
- for ((url, identifier, namedAfter), contents) in zip(candidates, walked) {
+ for (candidate, contents) in zip(candidates, walked) {
+ let url = candidate.url
// The item's own date changes when something is taken out of it, but not when a file inside is
// rewritten in place, so the newest date inside comes from the walk.
let own = try? url.resourceValues(forKeys: [.contentModificationDateKey]).contentModificationDate
@@ -396,23 +448,29 @@ public struct OrphanScanner: Sendable {
.holdsALibrary
} else if ProtectedData.holdsWorkKeptInACache(path) {
.holdsWorkKeptInACache
+ } else if location.kind == .logs, CrashReport.isOne(url) {
+ .crashReport
} else {
// `/Users/Shared` belongs to every account on the Mac, and the other accounts' apps are not known here.
HoldBack.seen(in: contents) ?? (location.kind == .sharedFolder ? .sharedWithEveryone : nil)
- ?? (namedAfter != nil ? .namedLikeTheApp : nil)
+ ?? (candidate.namedAfter != nil ? .namedLikeTheApp : nil)
}
let item = OrphanItem(
url: url,
kind: location.kind,
size: contents.flatMap { $0.couldNotBeRead ? nil : $0.size },
modificationDate: [own, contents?.newestChange].compactMap(\.self).max(),
- requiresPrivileges: parent.requiresPrivileges(toRemove: url),
+ requiresPrivileges: candidate.parent.requiresPrivileges(toRemove: url),
heldBack: heldBack,
- namedAfter: namedAfter,
+ namedAfter: candidate.namedAfter,
holdsDamagedSettings: location.kind == .preferences && PreferenceFile.isDamaged(url)
)
- found.append((identifier, item))
+ found.append((candidate.identifier, item))
}
- return .found(found)
+ return .found(
+ found,
+ cutShort: inside.wasCutShort ? location : nil,
+ unreadable: inside.unreadable.map { SearchLocation(kind: location.kind, url: $0) }
+ )
}
}
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/FileCommandTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/FileCommandTests.swift
index a07e2bf8..d06d2a1b 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/FileCommandTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/FileCommandTests.swift
@@ -510,6 +510,19 @@ struct FileCommandTests {
#expect(report["unreadableLocations"] as? [String] == ["/Users/me/Library/Containers"])
}
+ @Test func theOrphansListSaysWhereItStoppedLookingInsideFolders() {
+ let caches = SearchLocation(kind: .caches, url: URL(filePath: "/Users/me/Library/Caches", directoryHint: .isDirectory))
+ var scan = OrphanScan(groups: [], unreadableLocations: [caches], needsFullDiskAccess: true)
+ scan.cutShortLocations = [caches]
+
+ let notes = OrphansCommand.notes(for: scan)
+
+ #expect(notes == [
+ Output.fullDiskAccessNote,
+ "There are more folders in /Users/me/Library/Caches than Peel looks inside, so an orphaned file may be in a folder Peel didn't reach.",
+ ])
+ }
+
@Test func orphansListsNothingWhileAnAppFolderCannotBeRead() {
let studio = URL(filePath: "/Volumes/Studio/Apps", directoryHint: .isDirectory)
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/OrphanScannerTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/OrphanScannerTests.swift
index 5deb509a..3f279cef 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/OrphanScannerTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/OrphanScannerTests.swift
@@ -55,7 +55,8 @@ struct OrphanScannerTests {
private func scanner(
in directory: borrowing TemporaryDirectory,
registered: Set<String> = [],
- systemApps: [InstalledApp] = []
+ systemApps: [InstalledApp] = [],
+ nestedFolderLimit: Int = NestedSearch.folderLimit
) -> OrphanScanner {
let environment = SearchEnvironment(
homeDirectory: directory.url.appending(path: "home", directoryHint: .isDirectory),
@@ -64,7 +65,8 @@ struct OrphanScannerTests {
return OrphanScanner(
environment: environment,
isRegisteredApp: { registered.contains($0) },
- systemApps: systemApps
+ systemApps: systemApps,
+ nestedFolderLimit: nestedFolderLimit
)
}
@@ -527,6 +529,81 @@ struct OrphanScannerTests {
#expect(Set(scan.groups.flatMap(\.items).map(\.url.lastPathComponent)) == ["Gone.vst3", "Gone Reverb.component"])
}
+ /// An app can keep its files inside a maker's folder or another app's, a level or two below where Orphaned Files
+ /// reads names, as an uninstall finds them. Down there a dotted name is often only a file's, a lock or a backup,
+ /// so only what came with an app Peel saw go is listed.
+ @Test func findsWhatAnAppThatLeftKeptInsideSomebodyElsesFolder() async throws {
+ let directory = try TemporaryDirectory()
+ try directory.file("root/Library/Application Support/Example Software/org.example.mixer/settings.json")
+ try directory.file("home/Library/Application Support/Browser/NativeMessagingHosts/org.example.mixer.host.json")
+ try directory.file("root/Users/Shared/Library/Application Support/org.example.mixer/presets.db")
+ try directory.file("home/Library/Application Support/Example Editor/state.json.lock")
+ try directory.file("home/.config/example/config.bak.2026-09-06")
+ let gone = RememberedApp(
+ bundleIdentifier: "org.example.mixer", name: "Mixer", teamIdentifier: nil, lastSeen: .now,
+ lastPath: "/Applications/Mixer.app"
+ )
+
+ let scan = await scanner(in: directory).scan(installedApps: installed, remembered: [gone])
+
+ #expect(scan.groups.map(\.identifier) == ["org.example.mixer"])
+ let items = scan.groups.flatMap(\.items)
+ let temporary = directory.url.path(percentEncoded: false)
+ let found = items.map { $0.url.path(percentEncoded: false).replacingOccurrences(of: temporary, with: "") }
+ #expect(Set(found) == [
+ "root/Library/Application Support/Example Software/org.example.mixer",
+ "home/Library/Application Support/Browser/NativeMessagingHosts/org.example.mixer.host.json",
+ "root/Users/Shared/Library/Application Support/org.example.mixer",
+ ])
+ #expect(items.first { $0.kind == .sharedFolder }?.heldBack == .sharedWithEveryone)
+ }
+
+ /// A crash report is never selected on an app's page, since the app's developer may still ask for it, and the
+ /// same holds once the app is gone.
+ @Test func aCrashReportOfAnAppThatLeftIsLeftForThePersonToChoose() async throws {
+ let directory = try TemporaryDirectory()
+ let report = """
+ {"app_name":"Mixer","bug_type":"309","bundleID":"org.example.mixer","name":"Mixer","incident_id":"1"}
+ {"procName":"Mixer","exception":{"type":"EXC_CRASH"}}
+ """
+ try directory.file("home/Library/Logs/DiagnosticReports/Mixer-2026-09-01-101010.ips", contents: Data(report.utf8))
+ let gone = RememberedApp(
+ bundleIdentifier: "org.example.mixer", name: "Mixer", teamIdentifier: nil, lastSeen: .now,
+ lastPath: "/Applications/Mixer.app"
+ )
+
+ let items = await scanner(in: directory).scan(installedApps: installed, remembered: [gone]).groups
+ .flatMap(\.items)
+
+ #expect(items.map(\.url.lastPathComponent) == ["Mixer-2026-09-01-101010.ips"])
+ #expect(items.map(\.heldBack) == [.crashReport])
+ }
+
+ @Test(.permissionsHold) func saysWhichFolderInsideAPlaceItCouldNotRead() async throws {
+ let directory = try TemporaryDirectory()
+ try directory.file("home/Library/Application Support/Example Software/org.example.mixer/settings.json")
+ try directory.setPermissions(0, of: "home/Library/Application Support/Example Software")
+ defer { try? directory.setPermissions(0o755, of: "home/Library/Application Support/Example Software") }
+
+ let scan = await scanner(in: directory).scan(installedApps: installed)
+
+ #expect(scan.unreadableLocations.map(\.url.lastPathComponent) == ["Example Software"])
+ #expect(scan.unreadableLocations.map(\.kind) == [.applicationSupport])
+ #expect(!scan.needsFullDiskAccess)
+ }
+
+ @Test func saysWhereItStoppedLookingInsideFolders() async throws {
+ let directory = try TemporaryDirectory()
+ try directory.file("home/Library/Application Support/Vendor One/notes.txt")
+ try directory.file("home/Library/Application Support/Vendor Two/notes.txt")
+
+ let cut = await scanner(in: directory, nestedFolderLimit: 1).scan(installedApps: installed)
+ let whole = await scanner(in: directory).scan(installedApps: installed)
+
+ #expect(cut.cutShortLocations.map(\.kind) == [.applicationSupport])
+ #expect(whole.cutShortLocations.isEmpty)
+ }
+
@Test func marksAPreferenceFileThatIsNoPropertyList() async throws {
let directory = try TemporaryDirectory()
try directory.file("home/Library/Preferences/org.example.gone.plist", contents: Data("<plist".utf8))
diff --git a/Peel/Views/Orphans/OrphanList.swift b/Peel/Views/Orphans/OrphanList.swift
index cbef3a53..08e6e2d0 100644
--- a/Peel/Views/Orphans/OrphanList.swift
+++ b/Peel/Views/Orphans/OrphanList.swift
@@ -67,6 +67,19 @@ struct OrphanList: View {
ContentUnavailableView.search(text: searchText)
}
}
+ .safeAreaBar(edge: .bottom) {
+ Group {
+ if let cutShort = orphans.scan?.cutShortLocations, !cutShort.isEmpty {
+ Text("There are more folders in \(cutShort.map(\.url.abbreviatedPath).formatted(.list(type: .and))) than Peel looks inside, so an orphaned file may be in a folder Peel didn’t reach.")
+ .font(.caption)
+ .foregroundStyle(.secondary)
+ .padding(.horizontal, 12)
+ .padding(.bottom, 8)
+ .transition(.opacity)
+ }
+ }
+ .motion(.settle, .movement, value: orphans.scan?.cutShortLocations.isEmpty == false)
+ }
.columnSearch(text: $searchText, prompt: "Search Orphaned Files", when: orphans.scan?.groups.isEmpty == false)
.fadesInColumn(whenRowsChange: orphans.scan?.groups.map(\.id))
.navigationTitle(Text(Tool.orphans.title))