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.

Say when Plug-ins couldn't read a folder, and follow a linked one

Țugui Dragoș2abb6b82aeef
diff --git a/Localization/Peel/Localizable.xcstrings b/Localization/Peel/Localizable.xcstrings
index 79badcef..f70f24b6 100644
--- a/Localization/Peel/Localizable.xcstrings
+++ b/Localization/Peel/Localizable.xcstrings
@@ -89501,6 +89501,452 @@
}
}
},
+ "No plug-ins were found, but Peel couldn’t look in ^[%lld folder](inflect: true), so there may be some there. Give Peel Full Disk Access to look there too." : {
+ "localizations" : {
+ "cs" : {
+ "variations" : {
+ "plural" : {
+ "few" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Nenašly se žádné plug-iny, ale Peel nemohl nahlédnout do %lld složek, takže tam nějaké být mohou. Udělte Peelu plný přístup k disku, aby se mohl podívat i tam."
+ }
+ },
+ "many" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Nenašly se žádné plug-iny, ale Peel nemohl nahlédnout do %lld složky, takže tam nějaké být mohou. Udělte Peelu plný přístup k disku, aby se mohl podívat i tam."
+ }
+ },
+ "one" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Nenašly se žádné plug-iny, ale Peel nemohl nahlédnout do %lld složky, takže tam nějaké být mohou. Udělte Peelu plný přístup k disku, aby se mohl podívat i tam."
+ }
+ },
+ "other" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Nenašly se žádné plug-iny, ale Peel nemohl nahlédnout do %lld složek, takže tam nějaké být mohou. Udělte Peelu plný přístup k disku, aby se mohl podívat i tam."
+ }
+ }
+ }
+ }
+ },
+ "de" : {
+ "variations" : {
+ "plural" : {
+ "one" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Es wurden keine Plug-ins gefunden, aber Peel konnte in %lld Ordner nicht hineinsehen, daher könnte es dort welche geben. Gib Peel Festplattenvollzugriff, damit Peel auch dort nachsehen kann."
+ }
+ },
+ "other" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Es wurden keine Plug-ins gefunden, aber Peel konnte in %lld Ordner nicht hineinsehen, daher könnte es dort welche geben. Gib Peel Festplattenvollzugriff, damit Peel auch dort nachsehen kann."
+ }
+ }
+ }
+ }
+ },
+ "es" : {
+ "variations" : {
+ "plural" : {
+ "many" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "No se han encontrado módulos, pero Peel no ha podido mirar en %lld de carpetas, así que podría haber alguno ahí. Da a Peel acceso total al disco para que también mire ahí."
+ }
+ },
+ "one" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "No se han encontrado módulos, pero Peel no ha podido mirar en una carpeta, así que podría haber alguno ahí. Da a Peel acceso total al disco para que también mire ahí."
+ }
+ },
+ "other" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "No se han encontrado módulos, pero Peel no ha podido mirar en %lld carpetas, así que podría haber alguno ahí. Da a Peel acceso total al disco para que también mire ahí."
+ }
+ }
+ }
+ }
+ },
+ "fr" : {
+ "variations" : {
+ "plural" : {
+ "many" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Aucun module n’a été trouvé, mais Peel n’a pas pu regarder dans %lld de dossiers, qui peuvent donc en contenir. Accordez à Peel l’accès complet au disque pour qu’il y regarde aussi."
+ }
+ },
+ "one" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Aucun module n’a été trouvé, mais Peel n’a pas pu regarder dans %lld dossier, qui peut donc en contenir. Accordez à Peel l’accès complet au disque pour qu’il y regarde aussi."
+ }
+ },
+ "other" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Aucun module n’a été trouvé, mais Peel n’a pas pu regarder dans %lld dossiers, qui peuvent donc en contenir. Accordez à Peel l’accès complet au disque pour qu’il y regarde aussi."
+ }
+ }
+ }
+ }
+ },
+ "it" : {
+ "variations" : {
+ "plural" : {
+ "many" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Non sono stati trovati plugin, ma Peel non è riuscito a esaminare %lld di cartelle, quindi lì potrebbero essercene. Concedi a Peel l’accesso completo al disco per esaminare anche quelle."
+ }
+ },
+ "one" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Non sono stati trovati plugin, ma Peel non è riuscito a esaminare una cartella, quindi lì potrebbero essercene. Concedi a Peel l’accesso completo al disco per esaminare anche quella."
+ }
+ },
+ "other" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Non sono stati trovati plugin, ma Peel non è riuscito a esaminare %lld cartelle, quindi lì potrebbero essercene. Concedi a Peel l’accesso completo al disco per esaminare anche quelle."
+ }
+ }
+ }
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "プラグインは見つかりませんでしたが、Peelが調べられなかったフォルダが%lld個あるため、そこにプラグインがある可能性があります。そこも調べられるように、Peelにフルディスクアクセスを許可してください。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "플러그인을 찾지 못했지만, Peel이 폴더 %lld개를 살펴볼 수 없었으므로 그곳에 있을 수 있습니다. 그곳도 살펴보려면 Peel에 전체 디스크 접근 권한을 부여하십시오."
+ }
+ },
+ "nl" : {
+ "variations" : {
+ "plural" : {
+ "one" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Er zijn geen plug-ins gevonden, maar Peel kon niet in één map kijken, dus daar kunnen er nog zijn. Geef Peel volledige schijftoegang om daar ook te kijken."
+ }
+ },
+ "other" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Er zijn geen plug-ins gevonden, maar Peel kon niet in %lld mappen kijken, dus daar kunnen er nog zijn. Geef Peel volledige schijftoegang om daar ook te kijken."
+ }
+ }
+ }
+ }
+ },
+ "pl" : {
+ "variations" : {
+ "plural" : {
+ "few" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Nie znaleziono wtyczek, ale Peel nie mógł zajrzeć do %lld folderów, więc mogą tam jakieś być. Daj aplikacji Peel pełny dostęp do dysku, aby zajrzeć także tam."
+ }
+ },
+ "many" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Nie znaleziono wtyczek, ale Peel nie mógł zajrzeć do %lld folderów, więc mogą tam jakieś być. Daj aplikacji Peel pełny dostęp do dysku, aby zajrzeć także tam."
+ }
+ },
+ "one" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Nie znaleziono wtyczek, ale Peel nie mógł zajrzeć do %lld folderu, więc mogą tam jakieś być. Daj aplikacji Peel pełny dostęp do dysku, aby zajrzeć także tam."
+ }
+ },
+ "other" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Nie znaleziono wtyczek, ale Peel nie mógł zajrzeć do %lld folderu, więc mogą tam jakieś być. Daj aplikacji Peel pełny dostęp do dysku, aby zajrzeć także tam."
+ }
+ }
+ }
+ }
+ },
+ "pt" : {
+ "variations" : {
+ "plural" : {
+ "many" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Nenhum plug-in foi encontrado, mas o Peel não conseguiu examinar %lld de pastas, então pode haver alguns lá. Dê ao Peel Acesso Total ao Disco para que ele examine lá também."
+ }
+ },
+ "one" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Nenhum plug-in foi encontrado, mas o Peel não conseguiu examinar %lld pasta, então pode haver alguns lá. Dê ao Peel Acesso Total ao Disco para que ele examine lá também."
+ }
+ },
+ "other" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Nenhum plug-in foi encontrado, mas o Peel não conseguiu examinar %lld pastas, então pode haver alguns lá. Dê ao Peel Acesso Total ao Disco para que ele examine lá também."
+ }
+ }
+ }
+ }
+ },
+ "ro" : {
+ "variations" : {
+ "plural" : {
+ "few" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Nu s‑au găsit plug-inuri, dar Peel nu a putut căuta în %lld dosare, așa că acolo ar putea exista unele. Acordați aplicației Peel Acces complet la disc pentru a căuta și acolo."
+ }
+ },
+ "one" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Nu s‑au găsit plug-inuri, dar Peel nu a putut căuta în %lld dosar, așa că acolo ar putea exista unele. Acordați aplicației Peel Acces complet la disc pentru a căuta și acolo."
+ }
+ },
+ "other" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Nu s‑au găsit plug-inuri, dar Peel nu a putut căuta în %lld de dosare, așa că acolo ar putea exista unele. Acordați aplicației Peel Acces complet la disc pentru a căuta și acolo."
+ }
+ }
+ }
+ }
+ },
+ "ru" : {
+ "variations" : {
+ "plural" : {
+ "few" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Плагины не найдены, но Peel не смог заглянуть в %lld папки, так что там они могут быть. Предоставьте Peel полный доступ к диску, чтобы он заглянул и туда."
+ }
+ },
+ "many" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Плагины не найдены, но Peel не смог заглянуть в %lld папок, так что там они могут быть. Предоставьте Peel полный доступ к диску, чтобы он заглянул и туда."
+ }
+ },
+ "one" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Плагины не найдены, но Peel не смог заглянуть в %lld папку, так что там они могут быть. Предоставьте Peel полный доступ к диску, чтобы он заглянул и туда."
+ }
+ },
+ "other" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Плагины не найдены, но Peel не смог заглянуть в %lld папки, так что там они могут быть. Предоставьте Peel полный доступ к диску, чтобы он заглянул и туда."
+ }
+ }
+ }
+ }
+ },
+ "sv" : {
+ "variations" : {
+ "plural" : {
+ "one" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Inga insticksfiler hittades, men Peel kunde inte titta i en mapp, så det kan finnas några där. Ge Peel full skivtillgång för att titta där också."
+ }
+ },
+ "other" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Inga insticksfiler hittades, men Peel kunde inte titta i %lld mappar, så det kan finnas några där. Ge Peel full skivtillgång för att titta där också."
+ }
+ }
+ }
+ }
+ },
+ "tr" : {
+ "variations" : {
+ "plural" : {
+ "one" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Yazılım eki bulunamadı ama Peel %lld klasörün içine bakamadı, bu yüzden orada yazılım ekleri olabilir. Oraya da bakabilmesi için Peel’e Tam Disk Erişimi verin."
+ }
+ },
+ "other" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Yazılım eki bulunamadı ama Peel %lld klasörün içine bakamadı, bu yüzden orada yazılım ekleri olabilir. Oraya da bakabilmesi için Peel’e Tam Disk Erişimi verin."
+ }
+ }
+ }
+ }
+ },
+ "uk" : {
+ "variations" : {
+ "plural" : {
+ "few" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Плагінів не знайдено, але Peel не вдалося зазирнути в %lld папки, тож вони можуть бути там. Надайте Peel повний доступ до диска, щоб зазирнути й туди."
+ }
+ },
+ "many" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Плагінів не знайдено, але Peel не вдалося зазирнути в %lld папок, тож вони можуть бути там. Надайте Peel повний доступ до диска, щоб зазирнути й туди."
+ }
+ },
+ "one" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Плагінів не знайдено, але Peel не вдалося зазирнути в %lld папку, тож вони можуть бути там. Надайте Peel повний доступ до диска, щоб зазирнути й туди."
+ }
+ },
+ "other" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Плагінів не знайдено, але Peel не вдалося зазирнути в %lld папки, тож вони можуть бути там. Надайте Peel повний доступ до диска, щоб зазирнути й туди."
+ }
+ }
+ }
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "未找到插件,但有%lld个文件夹Peel无法查看,因此其中可能仍有插件。授予Peel完全磁盘访问权限,即可一并查看这些文件夹。"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "沒有找到外掛模組,但Peel無法查看%lld個檔案夾,因此那裡可能還有。請給予Peel「完全取用磁碟」權限,讓它也能查看那裡。"
+ }
+ }
+ }
+ },
+ "No plug-ins were found, but Peel couldn’t look inside %@, so there may be some there." : {
+ "localizations" : {
+ "cs" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Nenašly se žádné plug-iny, ale Peel nemohl nahlédnout do %@, takže tam nějaké být mohou."
+ }
+ },
+ "de" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Es wurden keine Plug-ins gefunden, aber Peel konnte in %@ nicht hineinsehen, daher könnte es dort welche geben."
+ }
+ },
+ "es" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "No se han encontrado módulos, pero Peel no ha podido mirar dentro de %@, así que podría haber alguno ahí."
+ }
+ },
+ "fr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Aucun module 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 plugin, 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 plug-ins gevonden, maar Peel kon niet in %@ kijken, dus daar kunnen er nog zijn."
+ }
+ },
+ "pl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Nie znaleziono wtyczek, ale Peel nie mógł zajrzeć do %@, więc mogą tam jakieś być."
+ }
+ },
+ "pt" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Nenhum plug-in 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 plug-inuri, 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 insticksfiler hittades, men Peel kunde inte titta i %@, så det kan finnas några där."
+ }
+ },
+ "tr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Yazılım eki bulunamadı ama Peel şu klasörlerin içine bakamadı: %@. Bu yüzden orada yazılım ekleri olabilir."
+ }
+ },
+ "uk" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Плагінів не знайдено, але Peel не вдалося зазирнути в %@, тож вони можуть бути там."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "未找到插件,但Peel无法查看%@内部,因此其中可能仍有插件。"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "沒有找到外掛模組,但Peel無法查看%@,因此那裡可能還有。"
+ }
+ }
+ }
+ },
"No recent apps in the Dock" : {
"localizations" : {
"cs" : {
diff --git a/Packages/PeelCore/Sources/PeelCore/Plugins/Plugins.swift b/Packages/PeelCore/Sources/PeelCore/Plugins/Plugins.swift
index 665f65ba..eb0ee52a 100644
--- a/Packages/PeelCore/Sources/PeelCore/Plugins/Plugins.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Plugins/Plugins.swift
@@ -76,6 +76,14 @@ extension Plugin.Category {
}
}
+/// The plug-ins one scan found, and the folders it couldn't read, which may hold more.
+public struct PluginScan: Sendable {
+ public var plugins: [Plugin] = []
+ public var unreadable: [URL] = []
+ /// True when macOS's privacy protection kept Peel out of one of them, which Full Disk Access lifts.
+ public var needsFullDiskAccess = false
+}
+
/// Finds the plug-ins that apps have installed in the folders macOS loads plug-ins from. Apple's own
/// components sit in the same folders and are left out, because macOS relies on them.
public enum Plugins {
@@ -96,7 +104,7 @@ public enum Plugins {
public static func scan(
environment: SearchEnvironment = .current,
exclusions: Exclusions = .none
- ) async -> [Plugin] {
+ ) async -> PluginScan {
await scan(environment: environment, exclusions: exclusions, measure: FileSize.measure)
}
@@ -105,16 +113,17 @@ public enum Plugins {
environment: SearchEnvironment,
exclusions: Exclusions,
measure: @escaping FileSize.Measure
- ) async -> [Plugin] {
+ ) async -> PluginScan {
let libraries = [
(environment.homeDirectory.appending(path: "Library", directoryHint: .isDirectory), false),
(environment.rootDirectory.appending(path: "Library", directoryHint: .isDirectory), true),
]
var found: [(url: URL, category: Plugin.Category, isForAllUsers: Bool)] = []
+ var unreadable: [URL] = []
for (library, isForAllUsers) in libraries {
for (folder, category) in folders {
let directory = library.appending(path: folder, directoryHint: .isDirectory)
- for url in bundles(in: directory, category: category)
+ for url in bundles(in: directory, category: category, unreadable: &unreadable)
where !Task.isCancelled && !exclusions.excludes(url) && !exclusions.holds(url) {
found.append((url, category, isForAllUsers))
}
@@ -139,7 +148,14 @@ public enum Plugins {
refusal: removalGuard.refusal(of: item.url)
)
}
- return plugins.compactMap(\.self).sorted { $0.name.localizedStandardCompare($1.name) == .orderedAscending }
+ let sorted = plugins.compactMap(\.self).sorted {
+ $0.name.localizedStandardCompare($1.name) == .orderedAscending
+ }
+ return PluginScan(
+ plugins: sorted,
+ unreadable: unreadable,
+ needsFullDiskAccess: unreadable.contains { FullDiskAccess.canList($0) == .missing }
+ )
}
/// The file extensions each kind of plug-in uses.
@@ -169,21 +185,31 @@ public enum Plugins {
]
/// Returns the plug-ins in `directory`, looking one level down inside folders that are not plug-ins
- /// themselves. A vendor can keep its plug-ins in a folder of its own, such as `VST3/<Company>/<Name>.vst3`.
- static func bundles(in directory: URL, category: Plugin.Category) -> [URL] {
- entries(of: directory).flatMap { url -> [URL] in
+ /// themselves. A vendor can keep its plug-ins in a folder of its own, such as `VST3/<Company>/<Name>.vst3`. A
+ /// folder that is there and can't be listed joins `unreadable`.
+ static func bundles(in directory: URL, category: Plugin.Category, unreadable: inout [URL]) -> [URL] {
+ entries(of: directory, unreadable: &unreadable).flatMap { url -> [URL] in
if isPluginBundle(url, category: category) { return [url] }
- return isFolder(url) ? entries(of: url).filter { isPluginBundle($0, category: category) } : []
+ guard isFolder(url) else { return [] }
+ return entries(of: url, unreadable: &unreadable).filter { isPluginBundle($0, category: category) }
}
}
- private static func entries(of directory: URL) -> [URL] {
- (try? FileManager.default.contentsOfDirectory(at: directory, includingPropertiesForKeys: [.isDirectoryKey]))
- ?? []
+ /// The entries of `directory`, through a link to a folder as the apps that load plug-ins go through one.
+ private static func entries(of directory: URL, unreadable: inout [URL]) -> [URL] {
+ guard isFolder(directory) else { return [] }
+ guard let names = try? FileManager.default.contentsOfDirectory(atPath: directory.path(percentEncoded: false))
+ else {
+ unreadable.append(directory)
+ return []
+ }
+ return names.map { directory.appending(path: $0) }
}
+ /// Whether `url` is a folder, or a link to one.
private static func isFolder(_ url: URL) -> Bool {
- (try? url.resourceValues(forKeys: [.isDirectoryKey]).isDirectory) == true
+ var info = stat()
+ return stat(url.path(percentEncoded: false), &info) == 0 && info.st_mode & S_IFMT == S_IFDIR
}
/// Whether `url` is a plug-in for `category`: a folder with one of the category's extensions, or any other
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/ExclusionsTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/ExclusionsTests.swift
index 364ca315..5df38519 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/ExclusionsTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/ExclusionsTests.swift
@@ -617,8 +617,10 @@ struct ExclusionsReachEveryScannerTests {
try directory.file("home/Library/QuickLook/Keep.qlgenerator/Contents/Info.plist", contents: Data("<plist/>".utf8))
let plugin = directory.url.appending(path: "home/Library/QuickLook/Keep.qlgenerator")
- let listed = await Plugins.scan(environment: environment(in: directory))
- let kept = await Plugins.scan(environment: environment(in: directory), exclusions: Exclusions(paths: [plugin]))
+ let listed = await Plugins.scan(environment: environment(in: directory)).plugins
+ let kept = await Plugins.scan(
+ environment: environment(in: directory), exclusions: Exclusions(paths: [plugin])
+ ).plugins
#expect(listed.contains { $0.url.lastPathComponent == "Keep.qlgenerator" })
#expect(!kept.contains { $0.url.lastPathComponent == "Keep.qlgenerator" }, "the scanner spells the path with /private and the exclusion does not")
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/PluginsTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/PluginsTests.swift
index c250be07..ef2ca2ab 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/PluginsTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/PluginsTests.swift
@@ -24,6 +24,29 @@ struct PluginsTests {
#expect(stop.askedAfter == 0)
}
+ @Test(.permissionsHold) func readsAFolderOfPlugInsThatIsALinkAndNamesOneItCannotRead() async throws {
+ let directory = try TemporaryDirectory()
+ try directory.directory("Elsewhere/VST3/Reverb.vst3/Contents")
+ try directory.directory("home/Library/Audio/Plug-Ins")
+ try FileManager.default.createSymbolicLink(
+ at: directory.url.appending(path: "home/Library/Audio/Plug-Ins/VST3"),
+ withDestinationURL: directory.url.appending(path: "Elsewhere/VST3")
+ )
+ let closed = try directory.directory("root/Library/Audio/Plug-Ins/Components/Vendor")
+ try directory.directory("root/Library/Audio/Plug-Ins/Components/Vendor/Synth.component")
+ try directory.setPermissions(0o000, of: closed)
+ defer { try? directory.setPermissions(0o755, of: closed) }
+ let environment = SearchEnvironment(
+ homeDirectory: directory.url.appending(path: "home", directoryHint: .isDirectory),
+ rootDirectory: directory.url.appending(path: "root", directoryHint: .isDirectory)
+ )
+
+ let scan = await Plugins.scan(environment: environment)
+
+ #expect(scan.plugins.map(\.name) == ["Reverb"])
+ #expect(scan.unreadable.map(\.lastPathComponent) == ["Vendor"])
+ }
+
@Test func findsPluginBundlesInUserAndSystemLibraries() async throws {
let directory = try TemporaryDirectory()
let info = try PropertyListSerialization.data(
@@ -41,7 +64,7 @@ struct PluginsTests {
homeDirectory: directory.url.appending(path: "home", directoryHint: .isDirectory),
rootDirectory: directory.url.appending(path: "root", directoryHint: .isDirectory)
)
- let plugins = await Plugins.scan(environment: environment)
+ let plugins = await Plugins.scan(environment: environment).plugins
#expect(plugins.map(\.name) == ["Ask", "Parrot", "Reverb"])
let reverb = try #require(plugins.last)
@@ -70,7 +93,7 @@ struct PluginsTests {
homeDirectory: directory.url.appending(path: "home", directoryHint: .isDirectory),
rootDirectory: directory.url.appending(path: "root", directoryHint: .isDirectory)
)
- let plugins = await Plugins.scan(environment: environment)
+ let plugins = await Plugins.scan(environment: environment).plugins
let found = Dictionary(uniqueKeysWithValues: plugins.map { ($0.name, $0.category) })
#expect(found == [
@@ -88,7 +111,7 @@ struct PluginsTests {
rootDirectory: directory.url.appending(path: "root", directoryHint: .isDirectory)
)
- let plugins = await Plugins.scan(environment: environment)
+ let plugins = await Plugins.scan(environment: environment).plugins
#expect(try #require(plugins.first { $0.category == .mailBundles }).refusal == nil)
#expect(try #require(plugins.first { $0.category == .vst3 }).refusal == nil)
@@ -107,7 +130,7 @@ struct PluginsTests {
rootDirectory: directory.url.appending(path: "root", directoryHint: .isDirectory)
)
- let plugins = await Plugins.scan(environment: environment)
+ let plugins = await Plugins.scan(environment: environment).plugins
#expect(plugins.map(\.name) == ["Delay", "Loose", "Reverb"])
#expect(!plugins.contains { $0.name.hasPrefix("Waves") }, "the vendor's folder was taken for a plug-in")
@@ -124,7 +147,7 @@ struct PluginsTests {
let plugins = await Plugins.scan(environment: environment, exclusions: .none) { url in
url.lastPathComponent == "Slow.vst3" ? nil : await FileSize.reclaimableSize(of: url, within: FileSize.budget)
- }
+ }.plugins
#expect(plugins.map(\.name) == ["Quick", "Slow"])
#expect(try #require(plugins.first?.size) >= 400_000)
@@ -165,7 +188,7 @@ struct PluginsTests {
/// `/Library/Audio/Plug-Ins/HAL`. The test checks names, since asking the scan's own signature question
/// again would test nothing.
@Test func leavesApplesOwnComponentsOutOfTheList() async {
- let listed = await Plugins.scan().map(\.name)
+ let listed = await Plugins.scan().plugins.map(\.name)
#expect(!listed.contains("ParrotAudioPlugin"))
#expect(!listed.contains { $0.hasPrefix("AU") && $0 != "AULab" }, "Apple's own audio units were listed: \(listed)")
}
diff --git a/Peel/Model/IntelLibrary.swift b/Peel/Model/IntelLibrary.swift
index 4a22430c..cee04336 100644
--- a/Peel/Model/IntelLibrary.swift
+++ b/Peel/Model/IntelLibrary.swift
@@ -26,7 +26,7 @@ final class IntelLibrary {
guard let result = await scanRun.run({
let exclusions = ExclusionsStore.shared.exclusions
async let backgroundItems = BackgroundItems.scan(exclusions: exclusions)
- let plugins = if let known { known } else { await Plugins.scan(exclusions: exclusions) }
+ let plugins = if let known { known } else { await Plugins.scan(exclusions: exclusions).plugins }
return await IntelInspector.scan(
installedApps: installedApps,
plugins: plugins,
diff --git a/Peel/Model/PluginLibrary.swift b/Peel/Model/PluginLibrary.swift
index 67ff8911..2d019703 100644
--- a/Peel/Model/PluginLibrary.swift
+++ b/Peel/Model/PluginLibrary.swift
@@ -5,6 +5,9 @@ import PeelCore
@Observable
final class PluginLibrary {
private(set) var plugins: [Plugin]?
+ /// The folders the last scan couldn't read, which may hold plug-ins it didn't list.
+ private(set) var unreadable: [URL] = []
+ private(set) var needsFullDiskAccess = false
/// The scan this page runs, which a newer one or the Stop button ends.
let scanRun = ScanRun()
var isScanning: Bool { scanRun.isRunning }
@@ -18,8 +21,10 @@ final class PluginLibrary {
func refresh() async {
guard let result = await scanRun.run({ await Plugins.scan(exclusions: ExclusionsStore.shared.exclusions) })
else { return }
- plugins = result
- if let selection, !result.contains(where: { $0.id == selection }) {
+ plugins = result.plugins
+ unreadable = result.unreadable
+ needsFullDiskAccess = result.needsFullDiskAccess
+ if let selection, !result.plugins.contains(where: { $0.id == selection }) {
self.selection = nil
}
}
diff --git a/Peel/Views/Plugins/PluginList.swift b/Peel/Views/Plugins/PluginList.swift
index 63331261..0c4eebc8 100644
--- a/Peel/Views/Plugins/PluginList.swift
+++ b/Peel/Views/Plugins/PluginList.swift
@@ -3,6 +3,7 @@ import SwiftUI
struct PluginList: View {
@Environment(PluginLibrary.self) private var plugins
+ @Environment(HomeModel.self) private var home
@State private var searchText = ""
@State private var isRescanning = false
@@ -12,6 +13,13 @@ struct PluginList: View {
let byCategory = Dictionary(grouping: filtered, by: \.category)
List(selection: $plugins.selection) {
+ if plugins.plugins?.isEmpty == false {
+ if plugins.needsFullDiskAccess {
+ FullDiskAccessBanner()
+ } else if !plugins.unreadable.isEmpty {
+ UnreadableFoldersNotice(folders: plugins.unreadable)
+ }
+ }
ForEach(Plugin.Category.allCases, id: \.self) { category in
if let items = byCategory[category] {
Section {
@@ -47,7 +55,21 @@ struct PluginList: View {
.accessibilityLabel(Text(Tool.plugins.title))
.scrollBarBelowSectionHeaders(!byCategory.isEmpty)
.scanState(phase(filtered), isRescanning: isRescanning, scan: plugins.scanRun) {
- if plugins.plugins?.isEmpty == true {
+ if plugins.plugins?.isEmpty == true, !plugins.unreadable.isEmpty {
+ ContentUnavailableView {
+ Label("Not Everything Could Be Read", systemImage: "exclamationmark.triangle")
+ } description: {
+ if plugins.needsFullDiskAccess {
+ Text("No plug-ins were found, but Peel couldn’t look in ^[\(plugins.unreadable.count) folder](inflect: true), so there may be some there. Give Peel Full Disk Access to look there too.")
+ } else {
+ Text("No plug-ins were found, but Peel couldn’t look inside \(plugins.unreadable.map(\.abbreviatedPath).formatted(.list(type: .and))), so there may be some there.")
+ }
+ } actions: {
+ if plugins.needsFullDiskAccess {
+ Button("Open System Settings") { home.openFullDiskAccessSettings() }
+ }
+ }
+ } else if plugins.plugins?.isEmpty == true {
ContentUnavailableView(
"No Plug-ins",
systemImage: "powerplug",
@@ -60,7 +82,13 @@ struct PluginList: View {
.columnSearch(text: $searchText, prompt: "Search Plug-ins", when: plugins.plugins?.isEmpty == false)
.fadesInColumn(whenRowsChange: plugins.plugins?.map(\.id))
.navigationTitle(Text(Tool.plugins.title))
- .announcesScan(plugins.isScanning, found: plugins.summary, wasStopped: plugins.scanRun.wasStopped)
+ .announcesScan(
+ plugins.isScanning,
+ found: plugins.summary,
+ couldNotLook: plugins.plugins?.isEmpty == true && !plugins.unreadable.isEmpty
+ ? "Not Everything Could Be Read" : nil,
+ wasStopped: plugins.scanRun.wasStopped
+ )
.toolbar {
ToolbarItem {
RescanButton(isRunning: $isRescanning, isDisabled: plugins.isRemoving, scan: plugins.scanRun) {