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.

Peel looks for apps in folders you choose, beside the Applications folders

Țugui Dragoșe6a4b19204ac
diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md
index 5235fa8c..c3375f63 100644
--- a/ARCHITECTURE.md
+++ b/ARCHITECTURE.md
@@ -199,6 +199,7 @@ where a Homebrew install takes them from.
| `~/Library/Application Support/Peel/digests.bin` | What Duplicates already read, so an unchanged file isn't read again. |
| `~/Library/Application Support/Peel/apps.json`, `teams.json` | What Peel remembers about apps and their signing teams between launches. |
| `~/Library/Application Support/Peel/orphan-owners.json` | The orphaned files the user said belong to an installed app. |
+| `~/Library/Application Support/Peel/app-folders.json` | The folders the user chose for Peel to look for apps in, beside the Applications folders. |
| `/private/var/db/com.tuguidragos.Peel.Helper/` | The helper's ledger of what it moved. |
| Peel's preferences | Settings, the totals Home shows, what each tool found the last time it looked, and the last answer of each update check. |
diff --git a/Localization/Peel/Localizable.xcstrings b/Localization/Peel/Localizable.xcstrings
index 765003e0..518abb8d 100644
--- a/Localization/Peel/Localizable.xcstrings
+++ b/Localization/Peel/Localizable.xcstrings
@@ -11971,6 +11971,112 @@
}
}
},
+ "App Folders" : {
+ "localizations" : {
+ "cs" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Složky aplikací"
+ }
+ },
+ "de" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "App-Ordner"
+ }
+ },
+ "es" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Carpetas de apps"
+ }
+ },
+ "fr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Dossiers d’apps"
+ }
+ },
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Cartelle delle app"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "アプリのフォルダ"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "앱 폴더"
+ }
+ },
+ "nl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Mappen met apps"
+ }
+ },
+ "pl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Foldery z aplikacjami"
+ }
+ },
+ "pt" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Pastas de Apps"
+ }
+ },
+ "ro" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Dosare de aplicații"
+ }
+ },
+ "ru" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Папки приложений"
+ }
+ },
+ "sv" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Appmappar"
+ }
+ },
+ "tr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Uygulama Klasörleri"
+ }
+ },
+ "uk" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Папки програм"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "App文件夹"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "App檔案夾"
+ }
+ }
+ }
+ },
"App Installers" : {
"localizations" : {
"cs" : {
@@ -67079,6 +67185,112 @@
}
}
},
+ "No other folder is on this list yet." : {
+ "localizations" : {
+ "cs" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Na tomto seznamu zatím není žádná další složka."
+ }
+ },
+ "de" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Auf dieser Liste steht noch kein anderer Ordner."
+ }
+ },
+ "es" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Aún no hay ninguna otra carpeta en esta lista."
+ }
+ },
+ "fr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Aucun autre dossier ne figure encore dans cette liste."
+ }
+ },
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "In questo elenco non ci sono ancora altre cartelle."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "このリストにはまだほかのフォルダがありません。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "아직 이 목록에 다른 폴더가 없습니다."
+ }
+ },
+ "nl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Er staat nog geen andere map in deze lijst."
+ }
+ },
+ "pl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Na tej liście nie ma jeszcze żadnego innego folderu."
+ }
+ },
+ "pt" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Ainda não há nenhuma outra pasta nesta lista."
+ }
+ },
+ "ro" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Niciun alt dosar nu este încă în această listă."
+ }
+ },
+ "ru" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "В этом списке пока нет других папок."
+ }
+ },
+ "sv" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Det finns ingen annan mapp i listan än."
+ }
+ },
+ "tr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Bu listede henüz başka klasör yok."
+ }
+ },
+ "uk" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "У цьому списку ще немає інших папок."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "此列表中还没有其他文件夹。"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "此列表中還沒有其他檔案夾。"
+ }
+ }
+ }
+ },
"No output." : {
"localizations" : {
"cs" : {
@@ -79826,6 +80038,112 @@
}
}
},
+ "Peel already looks in the Applications folders, and a folder as wide as a whole disk, your home folder, or a Library would slow down every look for apps. Choose the folder that holds the apps.\n\n%@" : {
+ "localizations" : {
+ "cs" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel už hledá ve složkách Aplikace a tak rozsáhlá složka jako celý disk, vaše domovská složka nebo složka Knihovna by zpomalila každé hledání aplikací. Zvolte složku, která aplikace obsahuje.\n\n%@"
+ }
+ },
+ "de" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel sucht bereits in den Ordnern „Programme“, und ein Ordner, der so umfassend ist wie ein ganzes Volume, dein Benutzerordner oder ein Library-Ordner, würde jede Suche nach Apps verlangsamen. Wähle den Ordner, in dem die Apps liegen.\n\n%@"
+ }
+ },
+ "es" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel ya busca en las carpetas Aplicaciones, y una carpeta tan amplia como un disco entero, tu carpeta de inicio o una carpeta Biblioteca ralentizaría cada búsqueda de apps. Elige la carpeta donde están las apps.\n\n%@"
+ }
+ },
+ "fr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel recherche déjà dans les dossiers Applications, et un dossier aussi vaste qu’un disque entier, votre dossier de départ ou un dossier Bibliothèque ralentirait chaque recherche d’apps. Choisissez le dossier qui contient les apps.\n\n%@"
+ }
+ },
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel cerca già le app nelle cartelle Applicazioni, e una cartella ampia quanto un intero disco, la tua cartella Inizio o una cartella Libreria rallenterebbe ogni ricerca di app. Scegli la cartella che contiene le app.\n\n%@"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peelはすでに“アプリケーション”フォルダを調べています。ディスク全体、ホームフォルダ、ライブラリフォルダのように範囲の広いフォルダを追加すると、アプリを探すたびに時間がかかるようになります。アプリが入っているフォルダを選択してください。\n\n%@"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel은 이미 응용 프로그램 폴더를 살펴보며, 디스크 전체, 홈 폴더 또는 라이브러리 폴더처럼 넓은 폴더는 앱을 찾을 때마다 속도를 느리게 합니다. 앱이 들어 있는 폴더를 선택하십시오.\n\n%@"
+ }
+ },
+ "nl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel zoekt al in de mappen 'Apps', en een map zo groot als een hele schijf, je thuismap of een bibliotheekmap zou elke zoekactie naar apps vertragen. Kies de map waarin de apps staan.\n\n%@"
+ }
+ },
+ "pl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel już szuka w folderach Aplikacje, a folder tak obszerny jak cały dysk, Twój folder domowy lub folder Biblioteki spowalniałby każde wyszukiwanie aplikacji. Wybierz folder, w którym są aplikacje.\n\n%@"
+ }
+ },
+ "pt" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "O Peel já procura nas pastas Aplicativos, e uma pasta tão ampla quanto um disco inteiro, a sua pasta pessoal ou uma pasta Biblioteca deixaria mais lenta cada busca por apps. Escolha a pasta que contém os apps.\n\n%@"
+ }
+ },
+ "ro" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel caută deja în dosarele Aplicații, iar un dosar la fel de cuprinzător ca un disc întreg, dosarul dvs. de reședință sau un dosar Bibliotecă ar încetini fiecare căutare de aplicații. Alegeți dosarul care conține aplicațiile.\n\n%@"
+ }
+ },
+ "ru" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel уже ищет в папках «Программы», а папка размером с целый диск, Ваша папка пользователя или папка «Библиотека» замедлила бы каждый поиск приложений. Выберите папку, в которой находятся приложения.\n\n%@"
+ }
+ },
+ "sv" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel letar redan i mapparna Appar, och en mapp så omfattande som en hel skiva, din hemmapp eller en biblioteksmapp skulle göra varje sökning efter appar långsammare. Välj mappen där apparna finns.\n\n%@"
+ }
+ },
+ "tr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel zaten Uygulamalar klasörlerinde arar; bütün bir disk, ana klasörünüz veya bir Kitaplık klasörü kadar geniş bir klasör ise uygulamalar için yapılan her aramayı yavaşlatır. Uygulamaların bulunduğu klasörü seçin.\n\n%@"
+ }
+ },
+ "uk" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel уже шукає в папках «Програми», а папка завширшки з цілий диск, ваша Домівка чи папка «Бібліотека» сповільнила б кожен пошук програм. Виберіть папку, у якій містяться програми.\n\n%@"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel已经会在“应用程序”文件夹中查找,而整个磁盘、你的个人文件夹或“资源库”文件夹这样宽泛的文件夹会拖慢每一次App查找。请选取存放这些App的文件夹。\n\n%@"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel已會在「應用程式」檔案夾中尋找App,而像整個磁碟、你的個人專屬檔案夾或「資源庫」檔案夾這樣大的範圍,會拖慢每次尋找App的速度。請選擇存放App的檔案夾。\n\n%@"
+ }
+ }
+ }
+ },
"Peel always keeps at least one copy." : {
"localizations" : {
"cs" : {
@@ -82582,6 +82900,112 @@
}
}
},
+ "Peel couldn’t save the app folders." : {
+ "localizations" : {
+ "cs" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Složky aplikací se Peelu nepodařilo uložit."
+ }
+ },
+ "de" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel konnte die App-Ordner nicht sichern."
+ }
+ },
+ "es" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel no ha podido guardar las carpetas de apps."
+ }
+ },
+ "fr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Impossible d’enregistrer les dossiers d’apps."
+ }
+ },
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Impossibile salvare le cartelle delle app."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peelはアプリのフォルダを保存できませんでした。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel이 앱 폴더를 저장할 수 없었습니다."
+ }
+ },
+ "nl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel kon de mappen met apps niet bewaren."
+ }
+ },
+ "pl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel nie mógł zachować folderów z aplikacjami."
+ }
+ },
+ "pt" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "O Peel não conseguiu salvar as pastas de apps."
+ }
+ },
+ "ro" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel nu a putut salva dosarele de aplicații."
+ }
+ },
+ "ru" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel не удалось сохранить папки приложений."
+ }
+ },
+ "sv" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel kunde inte spara appmapparna."
+ }
+ },
+ "tr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel uygulama klasörlerini kaydedemedi."
+ }
+ },
+ "uk" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel не вдалося зберегти папки програм."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel未能保存App文件夹。"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel無法儲存App檔案夾。"
+ }
+ }
+ }
+ },
"Peel couldn’t save the settings %@ has now, so it put nothing back." : {
"localizations" : {
"cs" : {
@@ -85382,6 +85806,112 @@
}
}
},
+ "Peel looks for apps in the Applications folders and in the folders on this list, such as one on another disk. While that disk isn’t connected, its apps still count as installed, so their files aren’t listed as orphaned." : {
+ "localizations" : {
+ "cs" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel hledá aplikace ve složkách Aplikace a ve složkách na tomto seznamu, například ve složce na jiném disku. Dokud tento disk není připojený, jeho aplikace se stále počítají jako nainstalované, takže jejich soubory se neuvádějí jako osiřelé."
+ }
+ },
+ "de" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel sucht in den Ordnern „Programme“ und in den Ordnern auf dieser Liste nach Apps, etwa in einem Ordner auf einem anderen Volume. Solange dieses Volume nicht verbunden ist, gelten seine Apps weiterhin als installiert, daher werden ihre Dateien nicht als verwaist aufgeführt."
+ }
+ },
+ "es" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel busca apps en las carpetas Aplicaciones y en las carpetas de esta lista, como una que esté en otro disco. Mientras ese disco no está conectado, sus apps siguen contando como instaladas, así que sus archivos no aparecen como huérfanos."
+ }
+ },
+ "fr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel recherche les apps dans les dossiers Applications et dans les dossiers de cette liste, par exemple un dossier situé sur un autre disque. Tant que ce disque n’est pas connecté, ses apps sont toujours considérées comme installées, et leurs fichiers ne sont donc pas listés comme orphelins."
+ }
+ },
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel cerca le app nelle cartelle Applicazioni e nelle cartelle di questo elenco, ad esempio una su un altro disco. Finché quel disco non è collegato, le sue app risultano comunque installate, quindi i loro file non vengono elencati in “File orfani”."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peelは“アプリケーション”フォルダと、このリストにあるフォルダ(別のディスク上のフォルダなど)でアプリを探します。そのディスクが接続されていない間も、そこにあるアプリはインストール済みとみなされるため、そのファイルが孤立ファイルとして表示されることはありません。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel은 응용 프로그램 폴더와 이 목록에 있는 폴더(예: 다른 디스크에 있는 폴더)에서 앱을 찾습니다. 해당 디스크가 연결되어 있지 않은 동안에도 그 안의 앱은 설치된 것으로 간주되므로, 해당 앱의 파일은 주인 없는 파일로 표시되지 않습니다."
+ }
+ },
+ "nl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel zoekt naar apps in de mappen 'Apps' en in de mappen in deze lijst, zoals een map op een andere schijf. Zolang die schijf niet is aangesloten, gelden de apps erop nog als geïnstalleerd, dus worden hun bestanden niet als verweesd getoond."
+ }
+ },
+ "pl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel szuka aplikacji w folderach Aplikacje i w folderach z tej listy, takich jak folder na innym dysku. Gdy ten dysk nie jest podłączony, jego aplikacje nadal są liczone jako zainstalowane, więc ich pliki nie są wyświetlane jako osierocone."
+ }
+ },
+ "pt" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "O Peel procura apps nas pastas Aplicativos e nas pastas desta lista, como uma em outro disco. Enquanto esse disco não estiver conectado, os apps dele continuam contando como instalados, então os arquivos deles não são listados como órfãos."
+ }
+ },
+ "ro" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel caută aplicații în dosarele Aplicații și în dosarele din această listă, de exemplu unul de pe alt disc. Cât timp acel disc nu este conectat, aplicațiile de pe el sunt considerate în continuare instalate, așa că fișierele lor nu sunt listate ca orfane."
+ }
+ },
+ "ru" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel ищет приложения в папках «Программы» и в папках из этого списка, например в папке на другом диске. Пока этот диск не подключен, его приложения по-прежнему считаются установленными, поэтому их файлы не показываются как осиротевшие."
+ }
+ },
+ "sv" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel letar efter appar i mapparna Appar och i mapparna i den här listan, till exempel en mapp på en annan skiva. Medan den skivan inte är ansluten räknas dess appar fortfarande som installerade, så deras filer listas inte som övergivna."
+ }
+ },
+ "tr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel, uygulamaları Uygulamalar klasörlerinde ve bu listedeki klasörlerde, örneğin başka bir diskteki bir klasörde arar. O disk bağlı değilken diskteki uygulamalar yüklü sayılmaya devam eder, bu yüzden dosyaları sahipsiz olarak listelenmez."
+ }
+ },
+ "uk" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel шукає програми в папках «Програми» та в папках із цього списку, як-от у папці на іншому диску. Поки цей диск не підʼєднано, його програми все одно вважаються інстальованими, тому їхні файли не показано як покинуті."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel会在“应用程序”文件夹和此列表中的文件夹(例如另一个磁盘上的文件夹)中查找App。该磁盘未连接时,其中的App仍算作已安装,因此它们的文件不会列为孤立文件。"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel會在「應用程式」檔案夾和此列表中的檔案夾(例如另一個磁碟上的檔案夾)裡尋找App。該磁碟未連接時,其中的App仍算作已安裝,因此它們的檔案不會列為孤立檔案。"
+ }
+ }
+ }
+ },
"Peel moves what it removes to the Trash, and History can put it back. As the GPL states, it comes with no warranty, to the extent the law allows." : {
"comment" : "Under the license's name. History is Peel's page of everything it moved to the Trash.",
"localizations" : {
@@ -113786,6 +114316,112 @@
}
}
},
+ "That folder can’t be added." : {
+ "localizations" : {
+ "cs" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Tuto složku nelze přidat."
+ }
+ },
+ "de" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Dieser Ordner kann nicht hinzugefügt werden."
+ }
+ },
+ "es" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Esa carpeta no se puede añadir."
+ }
+ },
+ "fr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Impossible d’ajouter ce dossier."
+ }
+ },
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Impossibile aggiungere quella cartella."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "そのフォルダは追加できません。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "해당 폴더는 추가할 수 없습니다."
+ }
+ },
+ "nl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Die map kan niet worden toegevoegd."
+ }
+ },
+ "pl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Tego folderu nie można dodać."
+ }
+ },
+ "pt" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Não é possível adicionar essa pasta."
+ }
+ },
+ "ro" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Acel dosar nu poate fi adăugat."
+ }
+ },
+ "ru" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Эту папку нельзя добавить."
+ }
+ },
+ "sv" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Den mappen kan inte läggas till."
+ }
+ },
+ "tr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "O klasör eklenemez."
+ }
+ },
+ "uk" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Цю папку не можна додати."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "无法添加该文件夹。"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "無法加入該檔案夾。"
+ }
+ }
+ }
+ },
"That folder can’t be excluded." : {
"localizations" : {
"cs" : {
@@ -122374,6 +123010,112 @@
}
}
},
+ "These folders can’t be added." : {
+ "localizations" : {
+ "cs" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Tyto složky nelze přidat."
+ }
+ },
+ "de" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Diese Ordner können nicht hinzugefügt werden."
+ }
+ },
+ "es" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Estas carpetas no se pueden añadir."
+ }
+ },
+ "fr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Impossible d’ajouter ces dossiers."
+ }
+ },
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Impossibile aggiungere queste cartelle."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "これらのフォルダは追加できません。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "이 폴더들은 추가할 수 없습니다."
+ }
+ },
+ "nl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Deze mappen kunnen niet worden toegevoegd."
+ }
+ },
+ "pl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Tych folderów nie można dodać."
+ }
+ },
+ "pt" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Não é possível adicionar estas pastas."
+ }
+ },
+ "ro" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Aceste dosare nu pot fi adăugate."
+ }
+ },
+ "ru" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Эти папки нельзя добавить."
+ }
+ },
+ "sv" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "De här mapparna kan inte läggas till."
+ }
+ },
+ "tr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Bu klasörler eklenemez."
+ }
+ },
+ "uk" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Ці папки не можна додати."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "无法添加这些文件夹。"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "無法加入這些檔案夾。"
+ }
+ }
+ }
+ },
"These folders can’t be excluded." : {
"localizations" : {
"cs" : {
diff --git a/Packages/PeelCore/Sources/PeelCore/Apps/AppCatalog.swift b/Packages/PeelCore/Sources/PeelCore/Apps/AppCatalog.swift
index f9524e86..64f35c64 100644
--- a/Packages/PeelCore/Sources/PeelCore/Apps/AppCatalog.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Apps/AppCatalog.swift
@@ -3,13 +3,26 @@ internal import PeelPrivileged
import Synchronization
public enum AppCatalog {
+ /// Where Peel looks for apps: the Applications folders and the folders the person chose (`AppFolders`).
public static var defaultDirectories: [URL] {
+ directories(adding: AppFolders().load())
+ }
+
+ static var standardDirectories: [URL] {
+ standardDirectories(home: .homeDirectory)
+ }
+
+ static func standardDirectories(home: URL) -> [URL] {
[
URL(filePath: "/Applications", directoryHint: .isDirectory),
- URL.homeDirectory.appending(path: "Applications", directoryHint: .isDirectory),
+ home.appending(path: "Applications", directoryHint: .isDirectory),
]
}
+ public static func directories(adding folders: [URL]) -> [URL] {
+ standardDirectories + folders
+ }
+
static var systemDirectories: [URL] {
[
"/System/Applications",
diff --git a/Packages/PeelCore/Sources/PeelCore/Apps/AppFolders.swift b/Packages/PeelCore/Sources/PeelCore/Apps/AppFolders.swift
new file mode 100644
index 00000000..cc2d115e
--- /dev/null
+++ b/Packages/PeelCore/Sources/PeelCore/Apps/AppFolders.swift
@@ -0,0 +1,79 @@
+public import Foundation
+internal import PeelPrivileged
+
+/// The folders the person chose for Peel to look for apps in, beside the Applications folders: another disk, or a
+/// folder of tools. Every reading of the installed apps looks in them, in the app and in `peel` alike.
+public struct AppFolders: Sendable {
+ public enum Refusal: Sendable, Equatable {
+ /// The disk, the home folder, or a folder of the system, which would make every reading of the apps slow.
+ case tooBroad
+ /// An Applications folder, or one inside it, which Peel already looks in.
+ case alreadyLookedIn
+ }
+
+ public let url: URL
+
+ public init(url: URL = AppFolders.defaultURL) {
+ self.url = url
+ }
+
+ public static var defaultURL: URL {
+ PeelFolder.url.appending(path: "app-folders.json")
+ }
+
+ public func load() -> [URL] {
+ FileLock.whileHeld(beside: url) { read() ?? [] }
+ }
+
+ /// Adds `folders`. False when they could not be saved, or when the file is there and cannot be read, since
+ /// writing over it would lose the folders it holds.
+ @discardableResult
+ public func add(_ folders: [URL]) -> Bool {
+ change { paths in
+ for path in folders.map({ PathPattern.comparablePath(of: $0) }) where !paths.contains(path) {
+ paths.append(path)
+ }
+ }
+ }
+
+ @discardableResult
+ public func remove(_ folders: [URL]) -> Bool {
+ let removed = Set(folders.map { PathPattern.comparablePath(of: $0) })
+ return change { paths in
+ paths.removeAll { removed.contains(PathPattern.comparablePath(of: URL(filePath: $0))) }
+ }
+ }
+
+ /// Why `folder` is not taken, compared without case since the disk folds it.
+ public static func refusal(of folder: URL, home: URL = .homeDirectory) -> Refusal? {
+ let path = folded(folder)
+ let broad = ["/", "/users", "/volumes", "/system", "/library", folded(home), folded(home) + "/library"]
+ if broad.contains(path) { return .tooBroad }
+ let lookedIn = AppCatalog.standardDirectories(home: home).contains {
+ PathComponents.isPath(path, atOrInside: folded($0))
+ }
+ return lookedIn ? .alreadyLookedIn : nil
+ }
+
+ private static func folded(_ url: URL) -> String {
+ PathPattern.comparablePath(of: url).lowercased()
+ }
+
+ private func change(_ edit: (inout [String]) -> Void) -> Bool {
+ FileLock.whileHeld(beside: url) {
+ guard var paths = read().map({ $0.map { $0.path(percentEncoded: false) } }) ?? (url.isMissing ? [] : nil)
+ else { return false }
+ edit(&paths)
+ guard let data = try? JSONEncoder().encode(paths) else { return false }
+ let folder = url.deletingLastPathComponent()
+ try? FileManager.default.createDirectory(at: folder, withIntermediateDirectories: true)
+ return (try? data.write(to: url, options: .atomic)) != nil
+ }
+ }
+
+ private func read() -> [URL]? {
+ guard let data = BoundedRead.data(at: url), let paths = try? JSONDecoder().decode([String].self, from: data)
+ else { return nil }
+ return paths.map { URL(filePath: $0, directoryHint: .isDirectory) }
+ }
+}
diff --git a/Packages/PeelCore/Sources/PeelCore/Apps/AppMemory.swift b/Packages/PeelCore/Sources/PeelCore/Apps/AppMemory.swift
index d2a808c3..a7b573bb 100644
--- a/Packages/PeelCore/Sources/PeelCore/Apps/AppMemory.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Apps/AppMemory.swift
@@ -14,6 +14,20 @@ public struct RememberedApp: Sendable, Hashable, Codable, Identifiable {
public var id: String { bundleIdentifier }
}
+extension RememberedApp {
+ /// The app as it is now, when Peel cannot tell that it left: its bundle is still where Peel last saw it, or the
+ /// disk it was on is not connected. Nil once the place can be looked at and the app is not there.
+ func stillInstalled() -> InstalledApp? {
+ let place = URL(filePath: lastPath, directoryHint: .isDirectory)
+ if let app = AppInspector.inspect(place), app.bundleIdentifier == bundleIdentifier { return app }
+ let names = PathComponents.of(lastPath)
+ guard names.count > 2, names[0] == "Volumes", URL(filePath: "/Volumes/\(names[1])").isMissing else {
+ return nil
+ }
+ return InstalledApp(url: place, bundleIdentifier: bundleIdentifier, name: name, teamIdentifier: teamIdentifier)
+ }
+}
+
public struct AppMemory: Sendable {
/// The most apps remembered, which is enough for any Mac. The least recently seen are dropped first.
public static let maximumApps = 2000
diff --git a/Packages/PeelCore/Sources/PeelCore/Orphans/OrphanScanner.swift b/Packages/PeelCore/Sources/PeelCore/Orphans/OrphanScanner.swift
index 75777a7b..92a1b302 100644
--- a/Packages/PeelCore/Sources/PeelCore/Orphans/OrphanScanner.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Orphans/OrphanScanner.swift
@@ -47,11 +47,15 @@ public struct OrphanScanner: Sendable {
owners: [String: String] = [:]
) async -> OrphanScan {
let systemApps = if let systemApps { systemApps } else { await AppCatalog.systemApps.value }
+ // `remembered` also holds the apps installed now, and only an app that is gone can have left files behind.
+ let listed = Set(installedApps.map { $0.bundleIdentifier.lowercased() })
+ let unlisted = remembered.filter { !listed.contains($0.bundleIdentifier.lowercased()) }
+ let outOfSight = unlisted.compactMap { $0.stillInstalled() }
+ let installedApps = installedApps + outOfSight
+ let here = listed.union(outOfSight.map { $0.bundleIdentifier.lowercased() })
+ let gone = unlisted.filter { !here.contains($0.bundleIdentifier.lowercased()) }
let ownership = AppOwnership(installedApps: installedApps + systemApps, isRegisteredApp: isRegisteredApp)
let jobs = BackgroundItemOwnership(installedApps: installedApps + systemApps)
- // `remembered` also holds the apps installed now, and only an app that is gone can have left files behind.
- let here = Set(installedApps.map { $0.bundleIdentifier.lowercased() })
- let gone = remembered.filter { !here.contains($0.bundleIdentifier.lowercased()) }
let goneBundles = Dictionary(
gone.map { (PathPattern.comparablePath(of: URL(filePath: $0.lastPath, directoryHint: .isDirectory)), $0.bundleIdentifier) },
uniquingKeysWith: { first, _ in first }
diff --git a/Packages/PeelCore/Sources/PeelCore/Removal/VendorRemoval.swift b/Packages/PeelCore/Sources/PeelCore/Removal/VendorRemoval.swift
index 7d8199d8..467d6296 100644
--- a/Packages/PeelCore/Sources/PeelCore/Removal/VendorRemoval.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Removal/VendorRemoval.swift
@@ -7,10 +7,10 @@ public enum VendorRemoval {
/// An uninstaller for `app`: one inside its bundle or beside it, or else one named for the app in the
/// folders where makers keep their uninstallers.
public static func uninstaller(for app: InstalledApp, applicationsFolders: [URL] = AppCatalog.defaultDirectories) -> URL? {
- shippedOrBeside(app) ?? namedForIt(app, in: applicationsFolders)
+ shippedOrBeside(app, applicationsFolders: applicationsFolders) ?? namedForIt(app, in: applicationsFolders)
}
- private static func shippedOrBeside(_ app: InstalledApp) -> URL? {
+ private static func shippedOrBeside(_ app: InstalledApp, applicationsFolders: [URL]) -> URL? {
let fileManager = FileManager.default
let insideBundle = ["Contents/Resources", "Contents/MacOS", "Contents/Helpers"].map {
app.url.appending(path: $0, directoryHint: .isDirectory)
@@ -18,7 +18,10 @@ public enum VendorRemoval {
let parent = app.url.deletingLastPathComponent()
// Inside the bundle, an uninstaller is the app's own even without the app's name. Beside the bundle it
// must carry the app's name, because a vendor's folder holds its other products and their uninstallers.
- let folders = insideBundle.map { ($0, true) } + (isApplicationsFolder(parent) ? [] : [(parent, false)])
+ let isEveryMakers = isApplicationsFolder(parent) || applicationsFolders.contains {
+ PathPattern.comparablePath(of: $0) == PathPattern.comparablePath(of: parent)
+ }
+ let folders = insideBundle.map { ($0, true) } + (isEveryMakers ? [] : [(parent, false)])
for (folder, isInsideTheBundle) in folders {
let names = (try? fileManager.contentsOfDirectory(atPath: folder.path(percentEncoded: false))) ?? []
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/AppFoldersTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/AppFoldersTests.swift
new file mode 100644
index 00000000..02e1132a
--- /dev/null
+++ b/Packages/PeelCore/Tests/PeelCoreTests/AppFoldersTests.swift
@@ -0,0 +1,34 @@
+import Foundation
+@testable import PeelCore
+import Testing
+
+struct AppFoldersTests {
+ /// A folder chosen for apps is looked through three levels deep. The whole disk, the home folder or a folder
+ /// Peel already looks in would only repeat or slow every reading of the apps.
+ @Test func refusesAFolderTooBroadOrAlreadyLookedIn() {
+ let home = URL(filePath: "/Users/someone", directoryHint: .isDirectory)
+ for path in ["/", "/Users", "/Volumes", "/System", "/Library", "/Users/someone", "/Users/someone/Library",
+ "/Applications", "/Applications/Utilities", "/Users/someone/Applications"] {
+ let folder = URL(filePath: path, directoryHint: .isDirectory)
+ #expect(AppFolders.refusal(of: folder, home: home) != nil, "\(path)")
+ }
+ for path in ["/Volumes/Studio/Apps", "/Users/someone/Tools"] {
+ let folder = URL(filePath: path, directoryHint: .isDirectory)
+ #expect(AppFolders.refusal(of: folder, home: home) == nil, "\(path)")
+ }
+ }
+
+ @Test func remembersTheFoldersChosenForApps() throws {
+ let directory = try TemporaryDirectory()
+ let folders = AppFolders(url: directory.url.appending(path: "app-folders.json"))
+ let studio = directory.url.appending(path: "Studio Apps", directoryHint: .isDirectory)
+ #expect(folders.load().isEmpty)
+
+ #expect(folders.add([studio]))
+ #expect(folders.load().map(\.lastPathComponent) == ["Studio Apps"])
+ #expect(AppCatalog.directories(adding: folders.load()).count == AppCatalog.standardDirectories.count + 1)
+
+ #expect(folders.remove([studio]))
+ #expect(folders.load().isEmpty)
+ }
+}
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/OrphanScannerTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/OrphanScannerTests.swift
index cc632785..485b6d54 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/OrphanScannerTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/OrphanScannerTests.swift
@@ -257,7 +257,7 @@ struct OrphanScannerTests {
try directory.file("home/Library/Caches/Sketchbook/cache.db")
let figma = RememberedApp(
bundleIdentifier: "com.figma.Desktop", name: "Figma", teamIdentifier: nil,
- lastSeen: .now.addingTimeInterval(-90 * 24 * 60 * 60), lastPath: "/Applications/Figma.app"
+ lastSeen: .now.addingTimeInterval(-90 * 24 * 60 * 60), lastPath: "/Applications/org.example.Figma.app"
)
let scanner = scanner(in: directory)
@@ -469,6 +469,31 @@ struct OrphanScannerTests {
#expect(Set(scan.groups.flatMap(\.items).map(\.url.lastPathComponent)) == ["Gone.vst3", "Gone Reverb.component"])
}
+ /// An app Peel no longer lists has left only when the place it was can be looked at and it is not there. One on
+ /// a disk that is not connected, or still in a folder Peel stopped looking in, is still installed, and its
+ /// files are not orphaned.
+ @Test func anAppThatIsOnlyOutOfSightHasNotLeft() async throws {
+ let directory = try TemporaryDirectory()
+ let info = """
+ <?xml version="1.0" encoding="UTF-8"?>
+ <plist version="1.0"><dict><key>CFBundleIdentifier</key><string>org.example-tools.app</string></dict></plist>
+ """
+ let tools = try directory.file("Tools/Tools.app/Contents/Info.plist", contents: Data(info.utf8))
+ .deletingLastPathComponent().deletingLastPathComponent()
+ for identifier in ["org.example-studio.app", "org.example-tools.app", "org.example-gone.app"] {
+ try directory.file("home/Library/Caches/\(identifier)/cache.db")
+ }
+ let remembered = [
+ ("org.example-studio.app", "/Volumes/org.example.NotConnected/Apps/Studio.app"),
+ ("org.example-tools.app", tools.path(percentEncoded: false)),
+ ("org.example-gone.app", "/Applications/org.example.Gone.app"),
+ ].map { RememberedApp(bundleIdentifier: $0, name: "App", teamIdentifier: nil, lastSeen: .now, lastPath: $1) }
+
+ let scan = await scanner(in: directory).scan(installedApps: installed, remembered: remembered)
+
+ #expect(scan.groups.map(\.identifier) == ["org.example-gone.app"])
+ }
+
/// What an item declares about itself is asked of the installed apps as its name is: a maker's plug-in, named for
/// what it does, and a container named by a UUID for an extension an installed app embeds are that app's.
@Test func anItemsDeclaredIdentifierIsAskedOfTheInstalledApps() async throws {
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/VendorRemovalTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/VendorRemovalTests.swift
index 9468650b..2901804d 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/VendorRemovalTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/VendorRemovalTests.swift
@@ -75,6 +75,24 @@ struct VendorRemovalTests {
#expect(VendorRemoval.uninstaller(for: photos, applicationsFolders: [applications]) == nil, "Photoshop's uninstaller names more than Photos")
}
+ /// A folder the person chose for apps holds every maker's apps, as an Applications folder does, whatever it is
+ /// called.
+ @Test func aFolderChosenForAppsIsReadLikeAnApplicationsFolder() throws {
+ let directory = try TemporaryDirectory()
+ let chosen = ["Studio Apps", "Tools"].map { directory.url.appending(path: $0, directoryHint: .isDirectory) }
+ try directory.directory("Studio Apps/Studio.app")
+ try directory.directory("Studio Apps/Uninstall Studio One.app")
+ try directory.directory("Tools/Studio.app")
+ try directory.directory("Tools/Uninstall Studio One.app")
+ try directory.directory("Tools/Studio Uninstaller.app")
+ let inStudioApps = app(in: directory, path: "Studio Apps/Studio.app", name: "Studio")
+ let inTools = app(in: directory, path: "Tools/Studio.app", name: "Studio")
+
+ #expect(VendorRemoval.uninstaller(for: inStudioApps, applicationsFolders: [chosen[0]]) == nil)
+ let named = VendorRemoval.uninstaller(for: inTools, applicationsFolders: chosen)
+ #expect(named?.lastPathComponent == "Studio Uninstaller.app")
+ }
+
@Test func listsSystemExtensionsInsideTheBundle() throws {
let directory = try TemporaryDirectory()
try directory.directory("Example.app/Contents/Library/SystemExtensions/com.example.app.filter.systemextension")
diff --git a/Peel/Model/AppLibrary.swift b/Peel/Model/AppLibrary.swift
index 6d5c5088..f89fdd5c 100644
--- a/Peel/Model/AppLibrary.swift
+++ b/Peel/Model/AppLibrary.swift
@@ -75,6 +75,10 @@ final class AppLibrary {
private(set) var lastOpenedRevision = 0
private(set) var isLoading = false
private(set) var hasLoaded = false
+ /// The folders the person chose for apps, beside the Applications folders. `PeelApp` watches them and reads the
+ /// apps again when they change.
+ private(set) var folders = AppFolders().load()
+ private(set) var couldNotSaveFolders = false
private(set) var updateStatuses: [InstalledApp.ID: UpdateStatus] = [:] {
didSet { updatesRevision += 1 }
}
@@ -184,6 +188,20 @@ final class AppLibrary {
return await refresh()
}
+ func addFolders(_ urls: [URL]) {
+ changeFolders { $0.add(urls) }
+ }
+
+ func removeFolders(_ urls: [URL]) {
+ changeFolders { $0.remove(urls) }
+ }
+
+ private func changeFolders(_ change: (AppFolders) -> Bool) {
+ let store = AppFolders()
+ couldNotSaveFolders = !change(store)
+ folders = store.load()
+ }
+
/// Reads the folders again without emptying the list first, so an app installed while Peel is open
/// appears in its place instead of the whole list blinking.
///
diff --git a/Peel/PeelApp.swift b/Peel/PeelApp.swift
index 128abae9..8e24b52b 100644
--- a/Peel/PeelApp.swift
+++ b/Peel/PeelApp.swift
@@ -92,35 +92,53 @@ struct PeelApp: App {
))
}
- /// Keeps the app list current as apps are installed and removed while Peel is open.
+ /// Keeps the app list current as apps are installed and removed while Peel is open, and as folders are added to
+ /// or removed from the ones it looks in.
private func followFolders() async {
- for await _ in FolderWatch.changes(in: AppCatalog.defaultDirectories) {
+ var watch: Task<Void, Never>?
+ defer { watch?.cancel() }
+ for await folders in Observations({ library.folders }) {
+ let foldersChanged = watch != nil
+ watch?.cancel()
+ watch = Task { await followApps(in: AppCatalog.directories(adding: folders), readingNow: foldersChanged) }
+ }
+ }
+
+ private func followApps(in folders: [URL], readingNow: Bool) async {
+ if readingNow {
+ await appsMayHaveChanged()
+ }
+ for await _ in FolderWatch.changes(in: folders) {
try? await Task.sleep(for: .seconds(1), tolerance: .milliseconds(250))
guard !Task.isCancelled else { return }
- let before = library.revision
- let changed = await library.refresh()
- // Any write inside a bundle wakes this loop, so Homebrew and the rest run only when the app list changed.
- guard library.revision != before else { continue }
- Task { await IconCache.warm(library.apps.map(\.url)) }
- await homebrew.refresh()
- // A newly installed app may match a cask Homebrew knows about, so the known casks are read again.
- await homebrew.loadKnownCasks(for: library.apps)
- library.loadHomebrewCasks(homebrew.caskEvidence)
- // A bundle that changed on disk is a different build, and what was cached about it describes the old
- // one. Those apps are checked again at once, whoever updated them: Peel, the Homebrew page, or
- // `brew upgrade` in Terminal.
- if checksForAppUpdates, !changed.isEmpty {
- await library.checkForUpdates(changed, force: true)
- }
- // A new build may be signed by a different team.
- if !changed.isEmpty {
- await library.checkSigningTeams()
- }
- // A newly installed app has never been checked, so it is due. The round checks only the apps that
- // are due.
- if checksForAppUpdates {
- await checkForUpdates()
- }
+ await appsMayHaveChanged()
+ }
+ }
+
+ private func appsMayHaveChanged() async {
+ let before = library.revision
+ let changed = await library.refresh()
+ // Any write inside a bundle wakes the watch, so Homebrew and the rest run only when the app list changed.
+ guard library.revision != before else { return }
+ Task { await IconCache.warm(library.apps.map(\.url)) }
+ await homebrew.refresh()
+ // A newly installed app may match a cask Homebrew knows about, so the known casks are read again.
+ await homebrew.loadKnownCasks(for: library.apps)
+ library.loadHomebrewCasks(homebrew.caskEvidence)
+ // A bundle that changed on disk is a different build, and what was cached about it describes the old
+ // one. Those apps are checked again at once, whoever updated them: Peel, the Homebrew page, or
+ // `brew upgrade` in Terminal.
+ if checksForAppUpdates, !changed.isEmpty {
+ await library.checkForUpdates(changed, force: true)
+ }
+ // A new build may be signed by a different team.
+ if !changed.isEmpty {
+ await library.checkSigningTeams()
+ }
+ // A newly installed app has never been checked, so it is due. The round checks only the apps that
+ // are due.
+ if checksForAppUpdates {
+ await checkForUpdates()
}
}
diff --git a/Peel/Views/Settings/AppFoldersSection.swift b/Peel/Views/Settings/AppFoldersSection.swift
new file mode 100644
index 00000000..c3e3ba27
--- /dev/null
+++ b/Peel/Views/Settings/AppFoldersSection.swift
@@ -0,0 +1,74 @@
+import PeelCore
+import SwiftUI
+import UniformTypeIdentifiers
+
+struct AppFoldersSection: View {
+ @Environment(AppLibrary.self) private var library
+ @State private var isChoosing = false
+ @State private var selected: Set<URL> = []
+ @State private var refused: [String] = []
+
+ private var isShowingRefusal: Binding<Bool> {
+ Binding(get: { !refused.isEmpty }, set: { if !$0 { refused = [] } })
+ }
+
+ var body: some View {
+ Section {
+ if library.folders.isEmpty {
+ Text("No other folder is on this list yet.")
+ .foregroundStyle(.secondary)
+ } else {
+ List(selection: $selected) {
+ ForEach(library.folders, id: \.self) { folder in
+ HStack(spacing: 8) {
+ AppIcon(url: folder)
+ .frame(width: 16, height: 16)
+ Text(folder.abbreviatedPath)
+ .lineLimit(1)
+ .truncationMode(.middle)
+ }
+ .tag(folder)
+ }
+ }
+ .frame(height: settingsListHeight(rows: library.folders.count))
+ .scrollContentBackground(.hidden)
+ .onDeleteCommand { removeSelected() }
+ }
+ if library.couldNotSaveFolders {
+ WarningLabel(title: Text("Peel couldn’t save the app folders."))
+ }
+ HStack {
+ Button("Add Folder…", systemImage: "plus") {
+ isChoosing = true
+ }
+ Spacer()
+ Button("Remove", systemImage: "minus") { removeSelected() }
+ .disabled(selected.isEmpty)
+ }
+ .editingControls()
+ } header: {
+ titled("App Folders", "Peel looks for apps in the Applications folders and in the folders on this list, such as one on another disk. While that disk isn’t connected, its apps still count as installed, so their files aren’t listed as orphaned.")
+ }
+ .fileImporter(
+ isPresented: $isChoosing, allowedContentTypes: [.folder], allowsMultipleSelection: true
+ ) { result in
+ guard let urls = try? result.get() else { return }
+ let refusedURLs = urls.filter { AppFolders.refusal(of: $0) != nil }
+ refused = refusedURLs.map(\.abbreviatedPath)
+ let adding = urls.filter { !refusedURLs.contains($0) }
+ guard !adding.isEmpty else { return }
+ library.addFolders(adding)
+ }
+ .alert(refused.count == 1 ? "That folder can’t be added." : "These folders can’t be added.", isPresented: isShowingRefusal) {
+ Button("OK", role: .cancel) {}
+ } message: {
+ Text("Peel already looks in the Applications folders, and a folder as wide as a whole disk, your home folder, or a Library would slow down every look for apps. Choose the folder that holds the apps.\n\n\(refused.joined(separator: "\n"))")
+ }
+ }
+
+ private func removeSelected() {
+ let removed = Array(selected)
+ selected = []
+ library.removeFolders(removed)
+ }
+}
diff --git a/Peel/Views/Settings/ExclusionsSettingsView.swift b/Peel/Views/Settings/ExclusionsSettingsView.swift
index 55ab3802..7d7a8542 100644
--- a/Peel/Views/Settings/ExclusionsSettingsView.swift
+++ b/Peel/Views/Settings/ExclusionsSettingsView.swift
@@ -20,12 +20,6 @@ struct ExclusionsSettingsView: View {
exclusions.exclusions.bundleIdentifiers.sorted()
}
- /// Returns the height of a list with `rows` entries, at 24 points a row: the list fits its entries, up to
- /// eight rows, and scrolls beyond that.
- private static func listHeight(rows: Int) -> CGFloat {
- CGFloat(min(rows, 8)) * 24
- }
-
private var isShowingRefusal: Binding<Bool> {
Binding(get: { !refused.isEmpty }, set: { if !$0 { refused = [] } })
}
@@ -65,7 +59,7 @@ struct ExclusionsSettingsView: View {
.tag(path)
}
}
- .frame(height: Self.listHeight(rows: paths.count))
+ .frame(height: settingsListHeight(rows: paths.count))
.scrollContentBackground(.hidden)
// The Delete key does what the Remove button does, as in other Mac lists.
.onDeleteCommand {
@@ -116,7 +110,7 @@ struct ExclusionsSettingsView: View {
.tag(identifier)
}
}
- .frame(height: Self.listHeight(rows: apps.count))
+ .frame(height: settingsListHeight(rows: apps.count))
.scrollContentBackground(.hidden)
.onDeleteCommand {
let removed = selectedApps
@@ -171,7 +165,7 @@ struct ExclusionsSettingsView: View {
.tag(group)
}
}
- .frame(height: Self.listHeight(rows: groups.count))
+ .frame(height: settingsListHeight(rows: groups.count))
.scrollContentBackground(.hidden)
.onDeleteCommand { forgetSelectedGroups() }
}
@@ -216,13 +210,3 @@ extension ExclusionsSettingsView {
Task { await orphans.forget(forgotten, from: library) }
}
}
-
-private extension View {
- /// Styles the buttons that add to a list and remove from it as small bordered buttons, 20 points high, the
- /// HIG's minimum on the Mac. A borderless pull-down stays 16 points high at every control size, so all four
- /// buttons use this style.
- func editingControls() -> some View {
- buttonStyle(.bordered)
- .controlSize(.small)
- }
-}
diff --git a/Peel/Views/Settings/SettingsListEditing.swift b/Peel/Views/Settings/SettingsListEditing.swift
new file mode 100644
index 00000000..8718bf7f
--- /dev/null
+++ b/Peel/Views/Settings/SettingsListEditing.swift
@@ -0,0 +1,17 @@
+import SwiftUI
+
+/// Returns the height of a Settings list with `rows` entries, at 24 points a row: the list fits its entries, up to
+/// eight rows, and scrolls beyond that.
+func settingsListHeight(rows: Int) -> CGFloat {
+ CGFloat(min(rows, 8)) * 24
+}
+
+extension View {
+ /// Styles the buttons that add to a list and remove from it as small bordered buttons, 20 points high, the
+ /// HIG's minimum on the Mac. A borderless pull-down stays 16 points high at every control size, so they all use
+ /// this style.
+ func editingControls() -> some View {
+ buttonStyle(.bordered)
+ .controlSize(.small)
+ }
+}
diff --git a/Peel/Views/Settings/SettingsView.swift b/Peel/Views/Settings/SettingsView.swift
index b7483d3e..f1c713a0 100644
--- a/Peel/Views/Settings/SettingsView.swift
+++ b/Peel/Views/Settings/SettingsView.swift
@@ -180,6 +180,8 @@ private struct GeneralSettingsView: View {
}
}
+ AppFoldersSection()
+
Section("While Peel Runs") {
toggle("Watch the Trash", isOn: $watchesTrash,
"When you move an app to the Trash yourself, Peel offers to remove the files it left behind. Peel stays in the menu bar to do it.")
diff --git a/README.md b/README.md
index 9d7cd923..e2a3e2f3 100644
--- a/README.md
+++ b/README.md
@@ -90,7 +90,8 @@ Peel is free and open source, and it speaks English and 17 other languages.
of waits under Review Before Removing.
- **Several ways in.** Choose an app in the list, drop one on Peel's Dock icon, select several apps at once, or
Control-click an app in Finder and choose Uninstall with Peel. With Watch the Trash on, Peel notices when you
- drag an app to the Trash yourself and offers to clear what it left behind.
+ drag an app to the Trash yourself and offers to clear what it left behind. Apps you keep outside the Applications
+ folders, such as on another disk, join the list once you add their folder in Settings > General > App Folders.
- **Reset instead of remove.** Clear an app's settings without uninstalling it. Peel saves them first, so you can
put them back, and never selects your own work.
- **Privacy permissions too, if you want.** Peel can also reset the permissions macOS gave the app, such as access