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.

Full Disk Access is asked for only when it would open the folder

Țugui Dragoș754070403947
diff --git a/Localization/Peel/Localizable.xcstrings b/Localization/Peel/Localizable.xcstrings
index 2ed63e8f..f99cea7e 100644
--- a/Localization/Peel/Localizable.xcstrings
+++ b/Localization/Peel/Localizable.xcstrings
@@ -69473,6 +69473,112 @@
}
}
},
+ "No orphaned files were found, but Peel couldn’t look inside %@, so there may be some there." : {
+ "localizations" : {
+ "cs" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Nenašly se žádné osiřelé soubory, ale Peel nemohl nahlédnout do %@, takže tam nějaké být mohou."
+ }
+ },
+ "de" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Es wurden keine verwaisten Dateien gefunden, aber Peel konnte in %@ nicht hineinsehen, daher könnte es dort welche geben."
+ }
+ },
+ "es" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "No se han encontrado archivos huérfanos, pero Peel no ha podido mirar dentro de %@, así que podría haber alguno ahí."
+ }
+ },
+ "fr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Aucun fichier orphelin n’a été trouvé, mais Peel n’a pas pu regarder dans %@, où il peut donc y en avoir."
+ }
+ },
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Non sono stati trovati file orfani, ma Peel non è riuscito a esaminare %@, quindi lì potrebbero essercene."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "孤立ファイルは見つかりませんでしたが、Peelが%@の中を調べられなかったため、そこに孤立ファイルがある可能性があります。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "주인 없는 파일을 찾지 못했지만, Peel이 %@ 안을 살펴볼 수 없었으므로 그곳에 있을 수 있습니다."
+ }
+ },
+ "nl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Er zijn geen verweesde bestanden gevonden, maar Peel kon niet in %@ kijken, dus daar kunnen er nog zijn."
+ }
+ },
+ "pl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Nie znaleziono osieroconych plików, ale Peel nie mógł zajrzeć do %@, więc mogą tam jakieś być."
+ }
+ },
+ "pt" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Nenhum arquivo órfão foi encontrado, mas o Peel não conseguiu examinar o conteúdo de %@, então pode haver alguns lá."
+ }
+ },
+ "ro" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Nu s‑au găsit fișiere orfane, dar Peel nu a putut căuta în %@, așa că acolo ar putea exista unele."
+ }
+ },
+ "ru" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Осиротевшие файлы не найдены, но Peel не смог заглянуть в %@, так что там они могут быть."
+ }
+ },
+ "sv" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Inga övergivna filer hittades, men Peel kunde inte titta i %@, så det kan finnas några där."
+ }
+ },
+ "tr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Sahipsiz dosya bulunamadı ama Peel şu klasörlerin içine bakamadı: %@. Bu yüzden orada sahipsiz dosyalar olabilir."
+ }
+ },
+ "uk" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Покинутих файлів не знайдено, але Peel не вдалося зазирнути в %@, тож вони можуть бути там."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "未找到孤立文件,但Peel无法查看%@内部,因此其中可能仍有孤立文件。"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "沒有找到孤立檔案,但Peel無法查看%@,因此那裡可能還有。"
+ }
+ }
+ }
+ },
"No other folder is on this list yet." : {
"localizations" : {
"cs" : {
@@ -85338,6 +85444,112 @@
}
}
},
+ "Peel couldn’t look inside %@, so something may be there that isn’t listed here." : {
+ "localizations" : {
+ "cs" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel nemohl nahlédnout do %@, takže tam může být něco, co tu není uvedeno."
+ }
+ },
+ "de" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel konnte in %@ nicht hineinsehen, daher könnte dort etwas liegen, das hier nicht aufgeführt ist."
+ }
+ },
+ "es" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel no ha podido mirar dentro de %@, así que podría haber algo ahí que no aparezca aquí."
+ }
+ },
+ "fr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel n’a pas pu regarder dans %@, il peut donc s’y trouver des éléments qui ne figurent pas ici."
+ }
+ },
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel non è riuscito a esaminare %@, quindi lì potrebbe esserci qualcosa che qui non è elencato."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peelは%@の中を調べられなかったため、ここに表示されていないものがそこにある可能性があります。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel이 %@ 안을 살펴볼 수 없었으므로 여기에 나열되지 않은 항목이 그곳에 있을 수 있습니다."
+ }
+ },
+ "nl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel kon niet in %@ kijken, dus daar kan iets staan dat hier niet wordt getoond."
+ }
+ },
+ "pl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel nie mógł zajrzeć do %@, więc może tam być coś, czego nie ma tutaj na liście."
+ }
+ },
+ "pt" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "O Peel não conseguiu examinar o conteúdo de %@, então pode haver algo lá que não está listado aqui."
+ }
+ },
+ "ro" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel nu a putut căuta în %@, așa că acolo ar putea exista ceva ce nu este listat aici."
+ }
+ },
+ "ru" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel не смог заглянуть в %@, так что там может быть что-то, что здесь не указано."
+ }
+ },
+ "sv" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel kunde inte titta i %@, så det kan finnas något där som inte visas här."
+ }
+ },
+ "tr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel şu klasörlerin içine bakamadı: %@. Bu yüzden orada, bu listede olmayan bir şey bulunabilir."
+ }
+ },
+ "uk" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel не вдалося зазирнути в %@, тож там може бути щось, чого немає в цьому списку."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel无法查看%@内部,因此其中可能有此处未列出的项目。"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel無法查看%@,因此那裡可能有這裡未列出的項目。"
+ }
+ }
+ }
+ },
"Peel couldn’t make sure Homebrew keeps the formulae your exclusions cover, so it ran nothing. A brew.env file that sets HOMEBREW_NO_CLEANUP_FORMULAE replaces the list Peel gives it." : {
"localizations" : {
"cs" : {
diff --git a/Packages/PeelCore/Sources/PeelCommandLine/Commands/AppCommands.swift b/Packages/PeelCore/Sources/PeelCommandLine/Commands/AppCommands.swift
index 7cff54cc..ddaf2bf3 100644
--- a/Packages/PeelCore/Sources/PeelCommandLine/Commands/AppCommands.swift
+++ b/Packages/PeelCore/Sources/PeelCommandLine/Commands/AppCommands.swift
@@ -183,7 +183,9 @@ struct LeftoversCommand: AsyncParsableCommand {
Output.note(note)
}
if !uninstallation.scan.unreadableLocations.isEmpty {
- Output.note(Output.fullDiskAccessNote)
+ let scan = uninstallation.scan
+ let folders = scan.unreadableLocations.map(\.url)
+ Output.note(Output.unreadableNote(for: folders, needsFullDiskAccess: scan.needsFullDiskAccess))
}
for location in uninstallation.scan.cutShortLocations {
Output.note("There are more folders in \(Output.plain(Output.path(location.url))) than Peel looks inside, so something of this app's may be in a folder Peel didn't reach.")
@@ -482,7 +484,8 @@ struct UninstallCommand: AsyncParsableCommand {
notes.append(note)
}
if !scan.unreadableLocations.isEmpty {
- notes.append(Output.fullDiskAccessNote)
+ let folders = scan.unreadableLocations.map(\.url)
+ notes.append(Output.unreadableNote(for: folders, needsFullDiskAccess: scan.needsFullDiskAccess))
}
notes += scan.cutShortLocations.map {
"There are more folders in \(Output.plain(Output.path($0.url))) than Peel looks inside, so something of this app's may be in a folder Peel didn't reach."
diff --git a/Packages/PeelCore/Sources/PeelCommandLine/Commands/FileCommands.swift b/Packages/PeelCore/Sources/PeelCommandLine/Commands/FileCommands.swift
index c855f5ea..3f33d2e3 100644
--- a/Packages/PeelCore/Sources/PeelCommandLine/Commands/FileCommands.swift
+++ b/Packages/PeelCore/Sources/PeelCommandLine/Commands/FileCommands.swift
@@ -89,7 +89,8 @@ struct OrphansCommand: AsyncParsableCommand {
}
}
if !scan.unreadableLocations.isEmpty {
- Output.note(Output.fullDiskAccessNote)
+ let folders = scan.unreadableLocations.map(\.url)
+ Output.note(Output.unreadableNote(for: folders, needsFullDiskAccess: scan.needsFullDiskAccess))
}
}
@@ -569,7 +570,9 @@ struct DuplicatesCommand: AsyncParsableCommand {
static func notes(for scan: DuplicateScan) -> [String] {
var notes: [String] = []
if !scan.unreadableLocations.isEmpty {
- notes.append(Output.fullDiskAccessNote)
+ notes.append(
+ Output.unreadableNote(for: scan.unreadableLocations, needsFullDiskAccess: scan.needsFullDiskAccess)
+ )
}
if !scan.skippedLocations.isEmpty {
let folders = scan.skippedLocations.map(Output.path).joined(separator: ", ")
diff --git a/Packages/PeelCore/Sources/PeelCommandLine/Support/Output.swift b/Packages/PeelCore/Sources/PeelCommandLine/Support/Output.swift
index 71835bc2..1298af21 100644
--- a/Packages/PeelCore/Sources/PeelCommandLine/Support/Output.swift
+++ b/Packages/PeelCore/Sources/PeelCommandLine/Support/Output.swift
@@ -176,6 +176,14 @@ enum Output {
static let fullDiskAccessNote = "Some folders couldn't be read. Give your terminal app Full Disk Access in System Settings to see everything."
+ /// What a scan couldn't look into: Full Disk Access when it would open them, otherwise the folders themselves,
+ /// since it does not open a folder closed by ordinary permissions.
+ static func unreadableNote(for folders: [URL], needsFullDiskAccess: Bool) -> String {
+ guard !needsFullDiskAccess else { return fullDiskAccessNote }
+ let listed = folders.map { plain(path($0)) }.joined(separator: ", ")
+ return "Peel couldn't look inside \(listed), so something may be there that isn't listed."
+ }
+
/// Whether the user can answer a question: standard input and standard error must both be a terminal. The
/// question goes to standard error, and with that redirected the user would see only a waiting cursor.
static var canAsk: Bool { isatty(STDIN_FILENO) == 1 && isatty(STDERR_FILENO) == 1 }
diff --git a/Packages/PeelCore/Sources/PeelCore/Leftovers/Leftover.swift b/Packages/PeelCore/Sources/PeelCore/Leftovers/Leftover.swift
index e915ac8e..aa5b8fe9 100644
--- a/Packages/PeelCore/Sources/PeelCore/Leftovers/Leftover.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Leftovers/Leftover.swift
@@ -207,6 +207,9 @@ public struct LeftoverScan: Sendable {
public let unreadableLocations: [SearchLocation]
/// Locations where the search inside other folders hit its limit, so some of the app's files may be missed.
public var cutShortLocations: [SearchLocation] = []
+ /// 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
/// Holds back, as `beyondTheHelper`, each item that needs an administrator and that the helper would refuse
/// once `app` has moved. An item already held back by a reason that blocks the move keeps its reason.
@@ -217,7 +220,8 @@ public struct LeftoverScan: Sendable {
return leftover.heldBack(.beyondTheHelper)
},
unreadableLocations: unreadableLocations,
- cutShortLocations: cutShortLocations
+ cutShortLocations: cutShortLocations,
+ needsFullDiskAccess: needsFullDiskAccess
)
}
@@ -230,7 +234,8 @@ public struct LeftoverScan: Sendable {
return LeftoverScan(
leftovers: merged.sorted(by: Leftover.comesBefore),
unreadableLocations: unreadableLocations,
- cutShortLocations: cutShortLocations
+ cutShortLocations: cutShortLocations,
+ needsFullDiskAccess: needsFullDiskAccess
)
}
}
diff --git a/Packages/PeelCore/Sources/PeelCore/Leftovers/LeftoverScanner.swift b/Packages/PeelCore/Sources/PeelCore/Leftovers/LeftoverScanner.swift
index 305d94d0..365b7d1c 100644
--- a/Packages/PeelCore/Sources/PeelCore/Leftovers/LeftoverScanner.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Leftovers/LeftoverScanner.swift
@@ -101,12 +101,16 @@ public struct LeftoverScanner: Sendable {
}
let leftovers = Self.merged(found)
+ let byPath: (SearchLocation, SearchLocation) -> Bool = {
+ $0.url.path(percentEncoded: false) < $1.url.path(percentEncoded: false)
+ }
return LeftoverScan(
leftovers: exclusions.keeping(leftovers, url: \.url)
.map { exclusions.holds($0.url) ? $0.heldBack(.holdsAnExclusion) : $0 }
.sorted(by: Leftover.comesBefore),
- unreadableLocations: unreadableLocations.sorted { $0.url.path(percentEncoded: false) < $1.url.path(percentEncoded: false) },
- cutShortLocations: cutShortLocations.sorted { $0.url.path(percentEncoded: false) < $1.url.path(percentEncoded: false) }
+ unreadableLocations: unreadableLocations.sorted(by: byPath),
+ cutShortLocations: cutShortLocations.sorted(by: byPath),
+ needsFullDiskAccess: unreadableLocations.contains { FullDiskAccess.canList($0.url) == .missing }
)
}
diff --git a/Packages/PeelCore/Sources/PeelCore/Orphans/Orphan.swift b/Packages/PeelCore/Sources/PeelCore/Orphans/Orphan.swift
index 608be4b9..f526de1d 100644
--- a/Packages/PeelCore/Sources/PeelCore/Orphans/Orphan.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Orphans/Orphan.swift
@@ -57,9 +57,15 @@ public struct OrphanGroup: Sendable, Hashable, Identifiable {
public struct OrphanScan: Sendable {
public let groups: [OrphanGroup]
public let unreadableLocations: [SearchLocation]
+ /// 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 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)
+ OrphanScan(
+ groups: groups.filter { $0.id != id }, unreadableLocations: unreadableLocations,
+ needsFullDiskAccess: needsFullDiskAccess
+ )
}
}
diff --git a/Packages/PeelCore/Sources/PeelCore/Orphans/OrphanScanner.swift b/Packages/PeelCore/Sources/PeelCore/Orphans/OrphanScanner.swift
index 149b7c1e..10d14e84 100644
--- a/Packages/PeelCore/Sources/PeelCore/Orphans/OrphanScanner.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Orphans/OrphanScanner.swift
@@ -100,7 +100,10 @@ public struct OrphanScanner: Sendable {
let teams = Set(installedApps.compactMap(\.teamIdentifier))
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) }
+ unreadableLocations: unreadableLocations.sorted {
+ $0.url.path(percentEncoded: false) < $1.url.path(percentEncoded: false)
+ },
+ needsFullDiskAccess: unreadableLocations.contains { FullDiskAccess.canList($0.url) == .missing }
)
}
diff --git a/Packages/PeelCore/Sources/PeelCore/Removal/BulkUninstallation.swift b/Packages/PeelCore/Sources/PeelCore/Removal/BulkUninstallation.swift
index 5580e5db..999bcf0d 100644
--- a/Packages/PeelCore/Sources/PeelCore/Removal/BulkUninstallation.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Removal/BulkUninstallation.swift
@@ -51,6 +51,9 @@ public struct BulkUninstallation: Sendable {
.filter { !$0.isExcluded && !$0.isPeels && !($0.isApplication && $0.isKeptByMacOS) && !$0.isBeyondTheHelper && !$0.isInTheTrash && $0.match?.heldBack?.cannotBeMoved != true }
.map { $0.isMeasured ? $0.size : nil })
}
+ public var needsFullDiskAccess: Bool {
+ uninstallations.contains { $0.scan.needsFullDiskAccess }
+ }
public var unreadableLocations: [SearchLocation] {
Array(Set(uninstallations.flatMap { $0.scan.unreadableLocations })).sorted { $0.url.path(percentEncoded: false) < $1.url.path(percentEncoded: false) }
}
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/CommandLineTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/CommandLineTests.swift
index cd335422..45730fb9 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/CommandLineTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/CommandLineTests.swift
@@ -402,6 +402,16 @@ struct CommandLineTests {
/// The notes shown before the user agrees to a removal. Each one names something that will still be on
/// the disk afterwards, so leaving one out would promise more than the removal does.
+ /// Full Disk Access does not open a folder closed by ordinary permissions, so then the folders are named instead.
+ @Test func namesTheFoldersFullDiskAccessWouldNotOpen() {
+ let locked = URL(filePath: "/Library/Application Support/Vendor")
+
+ let said = "Peel couldn't look inside /Library/Application Support/Vendor, so something may be there"
+ + " that isn't listed."
+ #expect(Output.unreadableNote(for: [locked], needsFullDiskAccess: false) == said)
+ #expect(Output.unreadableNote(for: [locked], needsFullDiskAccess: true) == Output.fullDiskAccessNote)
+ }
+
@Test func saysWhatWillStayBeforeItAsks() {
let app = InstalledApp(url: URL(filePath: "/Applications/Editor.app", directoryHint: .isDirectory), bundleIdentifier: "com.example.editor", name: "Editor")
let cache = URL(filePath: "/Users/me/Library/Caches/com.example.editor")
@@ -414,7 +424,9 @@ struct CommandLineTests {
keepLeftovers: false,
refusal: { _ in nil }
)
- let scan = LeftoverScan(leftovers: [], unreadableLocations: [caches], cutShortLocations: [caches])
+ let scan = LeftoverScan(
+ leftovers: [], unreadableLocations: [caches], cutShortLocations: [caches], needsFullDiskAccess: true
+ )
let notes = UninstallCommand.whatStays(plan, app: app, homebrew: CaskLookup.Answer(failure: "brew is not installed"), scan: scan)
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/LeftoverScannerTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/LeftoverScannerTests.swift
index df0b0550..6406443f 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/LeftoverScannerTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/LeftoverScannerTests.swift
@@ -342,6 +342,7 @@ struct LeftoverScannerTests {
#expect(scan.leftovers.isEmpty)
#expect(scan.unreadableLocations.map(\.kind) == [.logs])
+ #expect(!scan.needsFullDiskAccess, "Full Disk Access does not open a folder closed by ordinary permissions")
}
/// A vendor's folder the deep search cannot look into may hold the app's files, so the scan says it could not
@@ -357,6 +358,7 @@ struct LeftoverScannerTests {
#expect(scan.unreadableLocations.map(\.url.lastPathComponent) == ["Vendor"])
#expect(scan.unreadableLocations.map(\.kind) == [.applicationSupport])
+ #expect(!scan.needsFullDiskAccess)
}
@Test(.permissionsHold) func flagsItemsInReadOnlyLocationsAsRequiringPrivileges() async throws {
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/OrphanScannerTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/OrphanScannerTests.swift
index f78edf40..97802a4b 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/OrphanScannerTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/OrphanScannerTests.swift
@@ -308,6 +308,20 @@ struct OrphanScannerTests {
#expect(scan.unreadableLocations.isEmpty)
}
+ /// A location closed by ordinary permissions is reported, but Full Disk Access would not open it, so the scan
+ /// does not ask for it.
+ @Test(.permissionsHold) func aLocationClosedByPermissionsDoesNotAskForFullDiskAccess() async throws {
+ let directory = try TemporaryDirectory()
+ try directory.directory("home/Library/Logs/com.gone.app")
+ try directory.setPermissions(0, of: "home/Library/Logs")
+ defer { try? directory.setPermissions(0o755, of: "home/Library/Logs") }
+
+ let scan = await scanner(in: directory).scan(installedApps: installed)
+
+ #expect(scan.unreadableLocations.map(\.kind) == [.logs])
+ #expect(!scan.needsFullDiskAccess)
+ }
+
/// With the app gone, what it kept in `Data/Documents` may be the only copy of what its user made.
@Test func anOrphanedContainerThatHoldsDocumentsSaysSo() async throws {
let directory = try TemporaryDirectory()
diff --git a/Peel/Views/AppDetailView.swift b/Peel/Views/AppDetailView.swift
index abfc4c8a..b8bfdab1 100644
--- a/Peel/Views/AppDetailView.swift
+++ b/Peel/Views/AppDetailView.swift
@@ -156,8 +156,10 @@ struct AppDetailView: View {
.listRowSeparator(.hidden)
}
if let scan = plan.scan {
- if !scan.unreadableLocations.isEmpty {
+ if scan.needsFullDiskAccess {
FullDiskAccessBanner()
+ } else if !scan.unreadableLocations.isEmpty {
+ UnreadableFoldersNotice(folders: scan.unreadableLocations.map(\.url))
}
if !scan.cutShortLocations.isEmpty {
Notice(
diff --git a/Peel/Views/MultipleAppsView.swift b/Peel/Views/MultipleAppsView.swift
index bbd39855..99cfd7cc 100644
--- a/Peel/Views/MultipleAppsView.swift
+++ b/Peel/Views/MultipleAppsView.swift
@@ -26,8 +26,10 @@ struct MultipleAppsView: View {
RemovalsHeldBanner()
if plan.bulk != nil {
- if !plan.unreadableLocations.isEmpty {
+ if plan.bulk?.needsFullDiskAccess == true {
FullDiskAccessBanner()
+ } else if !plan.unreadableLocations.isEmpty {
+ UnreadableFoldersNotice(folders: plan.unreadableLocations.map(\.url))
}
if plan.requiresHelper, !helper.canAct {
HelperRequiredBanner()
diff --git a/Peel/Views/Orphans/OrphanDetailView.swift b/Peel/Views/Orphans/OrphanDetailView.swift
index 8f1c4c43..c6098100 100644
--- a/Peel/Views/Orphans/OrphanDetailView.swift
+++ b/Peel/Views/Orphans/OrphanDetailView.swift
@@ -12,8 +12,10 @@ struct OrphanDetailView: View {
.listRowSeparator(.hidden)
RemovalsHeldBanner()
- if orphans.scan?.unreadableLocations.isEmpty == false {
+ if orphans.scan?.needsFullDiskAccess == true {
FullDiskAccessBanner()
+ } else if let unreadable = orphans.scan?.unreadableLocations, !unreadable.isEmpty {
+ UnreadableFoldersNotice(folders: unreadable.map(\.url))
}
if group.items.contains(where: { $0.requiresPrivileges && $0.leftAlone == nil }), !helper.canAct {
HelperRequiredBanner()
diff --git a/Peel/Views/Orphans/OrphanList.swift b/Peel/Views/Orphans/OrphanList.swift
index af328042..efbf807f 100644
--- a/Peel/Views/Orphans/OrphanList.swift
+++ b/Peel/Views/Orphans/OrphanList.swift
@@ -30,9 +30,15 @@ struct OrphanList: View {
ContentUnavailableView {
Label("Not Everything Could Be Read", systemImage: "exclamationmark.triangle")
} description: {
- Text("No orphaned files were found, but Peel couldn’t look in ^[\(unreadable.count) folder](inflect: true), so there may be some there. Give Peel Full Disk Access to look there too.")
+ if orphans.scan?.needsFullDiskAccess == true {
+ Text("No orphaned files were found, but Peel couldn’t look in ^[\(unreadable.count) folder](inflect: true), so there may be some there. Give Peel Full Disk Access to look there too.")
+ } else {
+ Text("No orphaned files were found, but Peel couldn’t look inside \(unreadable.map(\.url.abbreviatedPath).formatted(.list(type: .and))), so there may be some there.")
+ }
} actions: {
- Button("Open System Settings") { home.openFullDiskAccessSettings() }
+ if orphans.scan?.needsFullDiskAccess == true {
+ Button("Open System Settings") { home.openFullDiskAccessSettings() }
+ }
}
} else if orphans.scan?.groups.isEmpty == true {
ContentUnavailableView(
diff --git a/Peel/Views/UnreadableFoldersNotice.swift b/Peel/Views/UnreadableFoldersNotice.swift
new file mode 100644
index 00000000..d8940fd0
--- /dev/null
+++ b/Peel/Views/UnreadableFoldersNotice.swift
@@ -0,0 +1,17 @@
+import SwiftUI
+
+/// Over a list whose scan could not look into folders that Full Disk Access would not open either, such as one
+/// closed by ordinary permissions. It names them, since something may be there that isn't listed.
+struct UnreadableFoldersNotice: View {
+ let folders: [URL]
+
+ var body: some View {
+ Notice(
+ title: Text("Some folders couldn’t be read"),
+ detail: Text("Peel couldn’t look inside \(folders.map(\.abbreviatedPath).formatted(.list(type: .and))), so something may be there that isn’t listed here."),
+ kind: .note
+ ) {}
+ .padding(.vertical, 6)
+ .listRowSeparator(.hidden)
+ }
+}