Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.
Swift cache-cleanercleanerclideveloper-toolsdisk-cleanupdisk-spaceduplicate-finderhomebrewliquid-glassmac-cleanermacosmacos-appmacos-golden-gatemacos-tahoemacos-tweaksswiftswiftuiterminal-themesuninstalluninstaller
Nothing moves while History can't be read
Țugui Dragoș6d3c37d5fbba
diff --git a/ARCHITECTURE.md b/ARCHITECTURE.mdindex ea95b079..6b93e49c 100644--- a/ARCHITECTURE.md+++ b/ARCHITECTURE.md@@ -90,8 +90,9 @@ Take the most common case, uninstalling an app. Every other page follows the samentry, even when it moved what was selected on several pages. Each item is also written down the moment itmoves (`removals.journal`, through `RemovalJournal`), so what a removal cut short moved reaches History thenext time it is read, as an interrupted removal, and quitting the app waits for a removal until History has it- (`QuitGuard`). What Peel refused to move is recorded too (`refusals.json`), and History lists it under Not- Moved, one removal to an entry.+ (`QuitGuard`). While History cannot be read nothing moves (`RemovalLog.canBeRead`, asked by `TrashService`+ before a removal) until the History page starts it over. What Peel refused to move is recorded too+ (`refusals.json`), and History lists it under Not Moved, one removal to an entry.8. **Put back.** History's Put Back reads its record as a request, not as a fact: an item returns only from areal Trash, only to a place the guard allows, and, through the helper, only if the helper's own ledger saysit moved that very item from that very place.diff --git a/Localization/Peel/Localizable.xcstrings b/Localization/Peel/Localizable.xcstringsindex ee8de022..3a5ed769 100644--- a/Localization/Peel/Localizable.xcstrings+++ b/Localization/Peel/Localizable.xcstrings@@ -70504,6 +70504,112 @@}}},+ "Open History" : {+ "localizations" : {+ "cs" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Otevřít Historii"+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Verlauf öffnen"+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Abrir Historial"+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Ouvrir l’Historique"+ }+ },+ "it" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Apri Cronologia"+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "履歴を開く"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "기록 열기"+ }+ },+ "nl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Open Geschiedenis"+ }+ },+ "pl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Otwórz Historię"+ }+ },+ "pt" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Abrir Histórico"+ }+ },+ "ro" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Deschideți Istoricul"+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Открыть Историю"+ }+ },+ "sv" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Öppna Historik"+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Geçmiş’i Aç"+ }+ },+ "uk" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Відкрити Історію"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "打开历史记录"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "打開歷史記錄"+ }+ }+ }+ },"Open Peel" : {"localizations" : {"cs" : {@@ -75597,6 +75703,218 @@}}},+ "Peel couldn’t read History" : {+ "localizations" : {+ "cs" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel nemohl přečíst Historii"+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel konnte den Verlauf nicht lesen"+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel no ha podido leer Historial"+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel n’a pas pu lire l’Historique"+ }+ },+ "it" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel non è riuscito a leggere la Cronologia"+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peelは履歴を読み取れませんでした"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel이 기록을 읽을 수 없음"+ }+ },+ "nl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel kon Geschiedenis niet lezen"+ }+ },+ "pl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel nie mógł odczytać Historii"+ }+ },+ "pt" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "O Peel não conseguiu ler o Histórico"+ }+ },+ "ro" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel nu a putut citi Istoricul"+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel не удалось прочитать Историю"+ }+ },+ "sv" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel kunde inte läsa Historik"+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel, Geçmiş’i okuyamadı"+ }+ },+ "uk" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel не вдалося прочитати Історію"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel无法读取“历史记录”"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel無法讀取「歷史記錄」"+ }+ }+ }+ },+ "Peel couldn’t read History, and it moves nothing it can’t put back." : {+ "localizations" : {+ "cs" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel nemohl přečíst Historii a nepřesouvá nic, co nemůže vrátit zpět."+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel konnte den Verlauf nicht lesen und verschiebt nichts, was sich nicht zurücklegen lässt."+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel no ha podido leer Historial, y no traslada nada que no pueda restaurar."+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel n’a pas pu lire l’Historique, et il ne déplace rien qu’il ne pourrait pas remettre en place."+ }+ },+ "it" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel non è riuscito a leggere la Cronologia, e non sposta nulla che non possa ripristinare."+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peelは履歴を読み取れませんでした。戻せないものは何も移動しません。"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel이 기록을 읽을 수 없었으며, 되돌려 놓을 수 없는 것은 아무것도 이동하지 않습니다."+ }+ },+ "nl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel kon Geschiedenis niet lezen en verplaatst niets wat het niet kan terugzetten."+ }+ },+ "pl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel nie mógł odczytać Historii i nie przenosi niczego, czego nie może przywrócić."+ }+ },+ "pt" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "O Peel não conseguiu ler o Histórico, e não move nada que não possa colocar de volta."+ }+ },+ "ro" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel nu a putut citi Istoricul și nu mută nimic din ce nu poate pune înapoi."+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel не удалось прочитать Историю, а он не перемещает ничего, что не сможет восстановить."+ }+ },+ "sv" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel kunde inte läsa Historik och flyttar inget som den inte kan lägga tillbaka."+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel, Geçmiş’i okuyamadı ve yerine koyamayacağı hiçbir şeyi taşımaz."+ }+ },+ "uk" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel не змогла прочитати Історію й не переміщує нічого, чого не може повернути."+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel无法读取“历史记录”,而它不会移动任何无法放回原处的内容。"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel無法讀取「歷史記錄」,而它不會移動任何無法還原的項目。"+ }+ }+ }+ },"Peel couldn’t read its own files." : {"localizations" : {"cs" : {@@ -77611,112 +77929,6 @@}}},- "Peel isn’t recording new removals, so it doesn’t overwrite what is there." : {- "localizations" : {- "cs" : {- "stringUnit" : {- "state" : "translated",- "value" : "Peel nová odstranění nezaznamenává, aby nepřepsal to, co v záznamu je."- }- },- "de" : {- "stringUnit" : {- "state" : "translated",- "value" : "Peel zeichnet nicht auf, was ab jetzt entfernt wird, damit das Vorhandene nicht überschrieben wird."- }- },- "es" : {- "stringUnit" : {- "state" : "translated",- "value" : "Peel no está registrando las eliminaciones nuevas, para no sobrescribir lo que hay."- }- },- "fr" : {- "stringUnit" : {- "state" : "translated",- "value" : "Peel n’enregistre pas les nouvelles suppressions, afin de ne pas écraser ce qui s’y trouve."- }- },- "it" : {- "stringUnit" : {- "state" : "translated",- "value" : "Peel non registra le nuove rimozioni, così non sovrascrive ciò che c’è."- }- },- "ja" : {- "stringUnit" : {- "state" : "translated",- "value" : "Peelは、既存の記録を上書きしないよう、新しくゴミ箱に入れた項目を記録していません。"- }- },- "ko" : {- "stringUnit" : {- "state" : "translated",- "value" : "Peel은 기존 기록을 덮어쓰지 않도록 새로운 제거 내역을 기록하지 않고 있습니다."- }- },- "nl" : {- "stringUnit" : {- "state" : "translated",- "value" : "Peel registreert geen nieuwe verwijderingen, zodat wat er staat niet wordt overschreven."- }- },- "pl" : {- "stringUnit" : {- "state" : "translated",- "value" : "Peel nie zapisuje nowych przeniesień do Kosza, więc nie nadpisuje tego, co już tam jest."- }- },- "pt" : {- "stringUnit" : {- "state" : "translated",- "value" : "O Peel não está registrando novas remoções, para não sobrescrever o que está lá."- }- },- "ro" : {- "stringUnit" : {- "state" : "translated",- "value" : "Peel nu înregistrează eliminările noi, ca să nu scrie peste ce se află acolo."- }- },- "ru" : {- "stringUnit" : {- "state" : "translated",- "value" : "Peel не записывает новые удаления, чтобы не перезаписать то, что там есть."- }- },- "sv" : {- "stringUnit" : {- "state" : "translated",- "value" : "Peel för inte in nya borttagningar, så att det som redan finns där inte skrivs över."- }- },- "tr" : {- "stringUnit" : {- "state" : "translated",- "value" : "Peel yeni kaldırma işlemlerini kaydetmiyor, böylece oradakinin üzerine yazmıyor."- }- },- "uk" : {- "stringUnit" : {- "state" : "translated",- "value" : "Peel не записує нових вилучень, щоб не перезаписати те, що там є."- }- },- "zh-Hans" : {- "stringUnit" : {- "state" : "translated",- "value" : "Peel目前不记录新的移除操作,因此不会覆盖已有的记录。"- }- },- "zh-Hant" : {- "stringUnit" : {- "state" : "translated",- "value" : "Peel目前不會記錄新的移除項目,以免覆寫現有的記錄。"- }- }- }- },"Peel kept the old file and continued with what it could still read. Items already in the Trash are still there: you can drag them back out in Finder." : {"localizations" : {"cs" : {@@ -80412,6 +80624,112 @@}}},+ "Peel removes nothing until you start History over, so that everything it moves can be put back." : {+ "localizations" : {+ "cs" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Dokud nezačnete Historii znovu, Peel nic neodstraní, aby vše, co přesune, šlo vrátit zpět."+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel entfernt nichts, bis du den Verlauf neu beginnst, damit sich alles, was Peel verschiebt, zurücklegen lässt."+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel no elimina nada hasta que vuelvas a empezar Historial, para que todo lo que traslade se pueda restaurar."+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel ne supprime rien tant que vous n’avez pas recommencé l’Historique, afin que tout ce qu’il déplace puisse être remis en place."+ }+ },+ "it" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel non rimuove nulla finché non ricominci la Cronologia da capo, in modo che tutto ciò che sposta si possa ripristinare."+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "履歴を最初からやり直すまで、Peelは何もゴミ箱に入れません。移動するものをすべて戻せるようにするためです。"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "기록을 처음부터 다시 시작하기 전까지 Peel은 이동하는 모든 항목을 되돌려 놓을 수 있도록 아무것도 제거하지 않습니다."+ }+ },+ "nl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel verwijdert niets totdat je opnieuw begint met Geschiedenis, zodat alles wat Peel verplaatst, kan worden teruggezet."+ }+ },+ "pl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel niczego nie przeniesie do Kosza, dopóki nie zaczniesz Historii od nowa, aby wszystko, co przeniesie, można było przywrócić."+ }+ },+ "pt" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "O Peel não remove nada até você recomeçar o Histórico, para que tudo o que ele mover possa ser colocado de volta."+ }+ },+ "ro" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel nu elimină nimic până când nu reîncepeți Istoricul, pentru ca tot ce mută să poată fi pus înapoi."+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel ничего не удаляет, пока Вы не начнете Историю заново, чтобы все, что он перемещает, можно было восстановить."+ }+ },+ "sv" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel tar inte bort något förrän du börjar om Historik, så att allt som Peel flyttar kan läggas tillbaka."+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Siz Geçmiş’i baştan başlatana kadar Peel hiçbir şeyi kaldırmaz, böylece taşıyacağı her şey yerine konabilir."+ }+ },+ "uk" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel нічого не вилучає, доки ви не почнете Історію наново, щоб усе, що Peel переміщує, можна було повернути."+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "在你重新开始“历史记录”之前,Peel不会移除任何内容,以确保它移动的所有内容都能放回原处。"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "在你重新開始「歷史記錄」之前,Peel不會移除任何項目,以確保它移動的所有項目都能還原。"+ }+ }+ }+ },"Peel removes only apps from that folder." : {"localizations" : {"cs" : {@@ -120906,6 +121224,112 @@}}},+ "Until it can read the record, or you start over, Peel removes nothing, because anything it moved now couldn’t be put back. Starting over keeps the old file beside a new one." : {+ "localizations" : {+ "cs" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Dokud Peel nedokáže záznam přečíst nebo dokud nezačnete znovu, nic neodstraní, protože kdyby teď něco přesunul, nešlo by to vrátit zpět. Když začnete znovu, starý soubor se ponechá vedle nového."+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Bis Peel die Aufzeichnung lesen kann oder du neu beginnst, entfernt Peel nichts, da sich nicht zurücklegen ließe, was jetzt verschoben würde. Wenn du neu beginnst, bleibt die alte Datei neben einer neuen erhalten."+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Hasta que pueda leer el registro, o hasta que vuelvas a empezar, Peel no elimina nada, porque cualquier cosa que trasladara ahora no se podría restaurar. Al volver a empezar, el archivo antiguo se conserva junto a uno nuevo."+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Tant que Peel ne peut pas lire le registre, ou que vous ne l’avez pas recommencé, il ne supprime rien, car tout ce qu’il déplacerait maintenant serait impossible à remettre en place. Si vous recommencez, l’ancien fichier est conservé à côté d’un nouveau."+ }+ },+ "it" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Finché non riesce a leggere il registro, o finché non ricominci da capo, Peel non rimuove nulla, perché qualsiasi cosa spostasse ora non si potrebbe ripristinare. Se ricominci da capo, il vecchio file viene conservato accanto a uno nuovo."+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "記録を読み取れるようになるか、最初からやり直すまで、Peelは何もゴミ箱に入れません。今何かを移動すると、それを戻せなくなるためです。最初からやり直すと、古いファイルは新しいファイルの横に保管されます。"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "기록을 읽을 수 있게 되거나 사용자가 처음부터 다시 시작하기 전까지, Peel은 지금 무엇을 이동하든 되돌려 놓을 수 없으므로 아무것도 제거하지 않습니다. 처음부터 다시 시작하면 이전 파일은 새 파일 옆에 보관됩니다."+ }+ },+ "nl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Totdat Peel de registratie kan lezen of jij opnieuw begint, verwijdert Peel niets, omdat wat Peel nu zou verplaatsen, niet kan worden teruggezet. Als je opnieuw begint, wordt het oude bestand naast een nieuw bestand bewaard."+ }+ },+ "pl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Dopóki Peel nie będzie mógł odczytać zapisu albo nie zaczniesz od nowa, niczego nie przeniesie do Kosza, ponieważ niczego, co by teraz przeniósł, nie dałoby się przywrócić. Gdy zaczniesz od nowa, stary plik zostanie zachowany obok nowego."+ }+ },+ "pt" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Até conseguir ler o registro, ou até você recomeçar, o Peel não remove nada, porque nada do que ele movesse agora poderia ser colocado de volta. Ao recomeçar, o arquivo antigo é guardado ao lado de um novo."+ }+ },+ "ro" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Până când poate citi evidența sau până când o reîncepeți, Peel nu elimină nimic, deoarece orice ar muta acum nu ar putea fi pus înapoi. Dacă o reîncepeți, fișierul vechi este păstrat lângă unul nou."+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Пока Peel не сможет прочитать журнал или пока Вы не начнете его заново, Peel ничего не удаляет, потому что то, что он переместил бы сейчас, нельзя было бы восстановить. Если начать заново, старый файл сохранится рядом с новым."+ }+ },+ "sv" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Tills Peel kan läsa förteckningen, eller tills du börjar om, tar Peel inte bort något, eftersom inget som Peel flyttade nu skulle kunna läggas tillbaka. När du börjar om sparas den gamla filen bredvid en ny."+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel, kaydı okuyabilene veya siz baştan başlayana kadar hiçbir şeyi kaldırmaz, çünkü şimdi taşıyacağı hiçbir şey yerine konamazdı. Baştan başladığınızda eski dosya yeni bir dosyanın yanında saklanır."+ }+ },+ "uk" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Доки Peel не зможе прочитати запис або доки ви не почнете наново, Peel нічого не вилучає, бо те, що вона зараз перемістила б, не можна було б повернути. Коли ви починаєте наново, старий файл зберігається поруч із новим."+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "在Peel能够读取该记录或你重新开始之前,Peel不会移除任何内容,因为如果它现在移动任何内容,都将无法放回原处。重新开始会将旧文件保留在新文件旁边。"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "在Peel能讀取這份記錄或你重新開始之前,Peel不會移除任何項目,因為它現在移動的任何項目都將無法還原。重新開始時,舊檔案會保留在新檔案旁邊。"+ }+ }+ }+ },"Until it can read them, or you start over, Peel removes nothing and puts nothing back, because it can’t tell what you asked it to leave alone. Adding or removing an entry below starts over too: the old file is kept beside the new one, but nothing in it counts anymore." : {"localizations" : {"cs" : {diff --git a/Packages/PeelCore/Sources/PeelCommandLine/Commands/AppCommands.swift b/Packages/PeelCore/Sources/PeelCommandLine/Commands/AppCommands.swiftindex 08e5d530..3d00f24e 100644--- a/Packages/PeelCore/Sources/PeelCommandLine/Commands/AppCommands.swift+++ b/Packages/PeelCore/Sources/PeelCommandLine/Commands/AppCommands.swift@@ -383,6 +383,9 @@ struct UninstallCommand: AsyncParsableCommand {throw CommandFailure("Moving \(target.name) to the Trash needs administrator access. Remove it with the Peel app.")}+ if let note = UnreadableHistory.note() {+ Output.note(note)+ }// The removal guard judges each item before printing, so the list shows what the move will really do.let plan = UninstallPlan.make(uninstallation, keepLeftovers: keepLeftovers, refusal: service.refusal(of:))if let refusal = plan.appStays {diff --git a/Packages/PeelCore/Sources/PeelCommandLine/Support/Cleanup.swift b/Packages/PeelCore/Sources/PeelCommandLine/Support/Cleanup.swiftindex daa06959..eb0f9286 100644--- a/Packages/PeelCore/Sources/PeelCommandLine/Support/Cleanup.swift+++ b/Packages/PeelCore/Sources/PeelCommandLine/Support/Cleanup.swift@@ -64,6 +64,9 @@ struct Cleanup {refusals: RefusalLog = RefusalLog(),move: (TrashService, [URL]) async -> TrashResult = { await $0.trash($1) }) async throws {+ if let note = UnreadableHistory.note(at: log.url) {+ Output.note(note)+ }// A third column, saying which items move and why the others stay, appears only when some item stays.let saysWhyItStays = !staying.isEmptyOutput.table(items.map { item indiff --git a/Packages/PeelCore/Sources/PeelCommandLine/Support/Output.swift b/Packages/PeelCore/Sources/PeelCommandLine/Support/Output.swiftindex e38d41be..e72bc3aa 100644--- a/Packages/PeelCore/Sources/PeelCommandLine/Support/Output.swift+++ b/Packages/PeelCore/Sources/PeelCommandLine/Support/Output.swift@@ -223,7 +223,7 @@ extension RemovalLogProblem {var summary: String {switch self {case .damaged(let setAside): "History was damaged, so it was kept as \(Output.path(setAside)) and started again."- case .unreadable: "History couldn't be read, so nothing new is being recorded."+ case .unreadable: "History couldn't be read, so Peel moves nothing until you start it over in the Peel app's History."case .couldNotRecord: "History couldn't be saved, so the last removal isn't in it."case .couldNotUpdate: "History couldn't be saved, so what was put back is still listed in it."}@@ -339,6 +339,7 @@ extension TrashFailure.Reason {case .needsHelper: "needs administrator access"case .movedWithoutATrace: "in the Trash where macOS didn't say, so only Finder can put it back"case .somethingElseMoved(let name): "something else was at that path; it is in the Trash as \(name)"+ case .historyUnreadable: "History can't be read"case .failed(let message): message}}diff --git a/Packages/PeelCore/Sources/PeelCommandLine/Support/UnreadableHistory.swift b/Packages/PeelCore/Sources/PeelCommandLine/Support/UnreadableHistory.swiftnew file mode 100644index 00000000..79a71769--- /dev/null+++ b/Packages/PeelCore/Sources/PeelCommandLine/Support/UnreadableHistory.swift@@ -0,0 +1,11 @@+import Foundation+import PeelCore++/// What `peel` says before a removal while History cannot be read: nothing moves, since what moved could not be+/// listed for Put Back, and the Peel app can start History over.+enum UnreadableHistory {+ static func note(at url: URL = RemovalHistory.defaultURL) -> String? {+ guard !RemovalLog.canBeRead(at: url) else { return nil }+ return "Peel couldn't read its History at \(url.path(percentEncoded: false)), so nothing will be moved. Open Peel and click Start Over in History."+ }+}diff --git a/Packages/PeelCore/Sources/PeelCore/Removal/RemovalJournal.swift b/Packages/PeelCore/Sources/PeelCore/Removal/RemovalJournal.swiftindex 914f9fd7..a78e10b2 100644--- a/Packages/PeelCore/Sources/PeelCore/Removal/RemovalJournal.swift+++ b/Packages/PeelCore/Sources/PeelCore/Removal/RemovalJournal.swift@@ -56,10 +56,18 @@ struct RemovalJournal: Sendable {}let url: URL+ /// The History log that takes in what the journal holds.+ let history: URL/// The journal beside the History log at `history`.init(beside history: URL) {url = history.deletingLastPathComponent().appending(path: "removals.journal")+ self.history = history+ }++ /// Whether History can be read, and so take in what is written here.+ var historyCanBeRead: Bool {+ RemovalLog.canBeRead(at: history)}/// Writes down `items`, which moved together in `batch`, one line each. An item the journal was in, Peel's owndiff --git a/Packages/PeelCore/Sources/PeelCore/Removal/RemovalLog.swift b/Packages/PeelCore/Sources/PeelCore/Removal/RemovalLog.swiftindex 8d3b8311..70677c19 100644--- a/Packages/PeelCore/Sources/PeelCore/Removal/RemovalLog.swift+++ b/Packages/PeelCore/Sources/PeelCore/Removal/RemovalLog.swift@@ -28,8 +28,11 @@ public struct RemovalLogOutcome: Sendable {public actor RemovalLog {/// The most records the file keeps. Past this, the oldest batches are dropped whole, never in part.static let maximumRecords = 20_000+ /// The largest file read as History. The file is Peel's, but any process of the user can rewrite it, and+ /// 20,000 records take about 6 MB.+ static let maximumBytes = 64 * 1_024 * 1_024- public let url: URL+ public nonisolated let url: URLpublic private(set) var problem: RemovalLogProblem?/// What removals moved and have not recorded yet, item by item.private let journal: RemovalJournal@@ -58,6 +61,22 @@ public actor RemovalLog {}}+ /// Whether History at `url` can be read, known without reading it: it is not there yet, or it opens as the file+ /// it should be. A History that cannot be read is never written over, and nothing moves meanwhile.+ public static func canBeRead(at url: URL = RemovalHistory.defaultURL) -> Bool {+ url.isMissing || BoundedRead.opens(url, maximum: maximumBytes)+ }++ /// Keeps a History that cannot be read beside the new one, under another name, and starts recording again.+ public func startOver() -> RemovalLogOutcome {+ whileNoOtherProcessWrites {+ guard stored() == nil else { return RemovalLogOutcome(records: current(), problem: problem) }+ guard DamagedFile.setAside(url) != nil else { return RemovalLogOutcome(records: nil, problem: problem) }+ problem = nil+ return RemovalLogOutcome(records: current(), problem: problem)+ }+ }+public func remove(_ ids: Set<UUID>) -> RemovalLogOutcome {whileNoOtherProcessWrites {guard let existing = current() else { return RemovalLogOutcome(records: nil, problem: problem) }@@ -114,9 +133,7 @@ public actor RemovalLog {note(nil)return []}- // Bounded like every other read: the file is Peel's, but any process of the user can rewrite it. The- // limit leaves plenty of room, since 20,000 records take about 6 MB.- guard let data = BoundedRead.data(at: url, maximum: 64 * 1_024 * 1_024) else {+ guard let data = BoundedRead.data(at: url, maximum: Self.maximumBytes) else {note(.unreadable)return nil}diff --git a/Packages/PeelCore/Sources/PeelCore/Removal/TrashService.swift b/Packages/PeelCore/Sources/PeelCore/Removal/TrashService.swiftindex 4f667807..797a72fc 100644--- a/Packages/PeelCore/Sources/PeelCore/Removal/TrashService.swift+++ b/Packages/PeelCore/Sources/PeelCore/Removal/TrashService.swift@@ -21,6 +21,8 @@ public struct TrashFailure: Sendable, Hashable {case movedWithoutATrace/// What moved by name was not the item the guard checked. It is in the Trash under this name.case somethingElseMoved(named: String)+ /// History cannot be read, so nothing moves: what moved could not be listed for Put Back.+ case historyUnreadablecase failed(String)}@@ -46,6 +48,7 @@ extension TrashFailure.Reason {case .needsHelper: "needs-helper"case .movedWithoutATrace: "moved-without-a-trace"case .somethingElseMoved: "something-else-moved"+ case .historyUnreadable: "history-unreadable"case .failed: "failed"}}@@ -69,6 +72,7 @@ extension TrashFailure.Reason {case "needs-helper": self = .needsHelpercase "moved-without-a-trace": self = .movedWithoutATracecase "something-else-moved": self = .somethingElseMoved(named: detail ?? "")+ case "history-unreadable": self = .historyUnreadablecase "failed": self = .failed(detail ?? "")default: return nil}@@ -169,7 +173,22 @@ public struct TrashService: Sendable {/// Why the guard would refuse to move `url`, or nil when it would move. A plan can show this before anything/// moves, since the move asks the same guard.public func refusal(of url: URL) -> TrashFailure.Reason? {- removalGuard.allowsRemoval(of: url) ? nil : .protectedLocation+ guard removalGuard.allowsRemoval(of: url) else { return .protectedLocation }+ return historyCanBeRead ? nil : .historyUnreadable+ }++ /// Whether the History this service's moves are recorded in can be read. Nothing moves while it cannot, since+ /// what moved could not be listed for Put Back.+ private var historyCanBeRead: Bool {+ journal?.historyCanBeRead ?? true+ }++ /// Every item of `urls` refused, while History cannot be read. An item the guard refuses keeps that reason,+ /// which outlasts this one.+ private func refusingAllWhileHistoryCannotBeRead(_ urls: [URL]) -> TrashResult? {+ guard !historyCanBeRead else { return nil }+ let refused = urls.map { TrashFailure(url: $0, reason: removalGuard.allowsRemoval(of: $0) ? .historyUnreadable : .protectedLocation) }+ return TrashResult(failures: refused)}/// Moves `urls` to the Trash as the current user, then stops the launchd jobs and forgets the preference@@ -177,7 +196,8 @@ public struct TrashService: Sendable {/// is forgotten even when Apple wrote the app.@concurrentpublic func trash(_ urls: [URL], ownedBy owner: String? = nil) async -> TrashResult {- await trash(urls, ownedBy: owner, removal: UUID())+ if let refused = refusingAllWhileHistoryCannotBeRead(urls) { return refused }+ return await trash(urls, ownedBy: owner, removal: UUID())}/// Moves files Peel made for itself, which History never lists, such as a copy of settings it could not@@ -225,6 +245,7 @@ public struct TrashService: Sendable {/// Moves `privilegedURLs` through the privileged helper and everything else as the current user.@concurrentpublic func trash(_ urls: [URL], usingHelperFor privilegedURLs: Set<URL>) async -> TrashResult {+ if let refused = refusingAllWhileHistoryCannotBeRead(urls) { return refused }let removal = UUID()var result = await trash(urls.filter { !privilegedURLs.contains($0) }, ownedBy: nil, removal: removal)let helperURLs = urls.filter(privilegedURLs.contains)diff --git a/Packages/PeelCore/Sources/PeelCore/Support/BoundedRead.swift b/Packages/PeelCore/Sources/PeelCore/Support/BoundedRead.swiftindex 6508feb4..68d3535b 100644--- a/Packages/PeelCore/Sources/PeelCore/Support/BoundedRead.swift+++ b/Packages/PeelCore/Sources/PeelCore/Support/BoundedRead.swift@@ -16,11 +16,8 @@ enum BoundedRead {/// after would let the file be swapped for a pipe in between. A symbolic link is followed, since users/// link launch agents and settings in from a repository.static func data(at url: URL, maximum: Int = maximumBytes, read: Read = { Darwin.read($0, $1, $2) }) -> Data? {- let descriptor = open(url.path(percentEncoded: false), O_RDONLY | O_NONBLOCK | O_CLOEXEC)- guard descriptor >= 0 else { return nil }+ guard let descriptor = openRegularFile(at: url, maximum: maximum) else { return nil }defer { close(descriptor) }- var info = stat()- guard fstat(descriptor, &info) == 0, info.st_mode & S_IFMT == S_IFREG, info.st_size <= maximum else { return nil }var data = Data()var buffer = [UInt8](repeating: 0, count: 64 * 1_024)@@ -38,6 +35,26 @@ enum BoundedRead {return data.count <= maximum ? data : nil}+ /// Whether `url` opens as a regular file of at most `maximum` bytes, which is what `data(at:maximum:)` asks+ /// before it reads.+ static func opens(_ url: URL, maximum: Int = maximumBytes) -> Bool {+ guard let descriptor = openRegularFile(at: url, maximum: maximum) else { return false }+ close(descriptor)+ return true+ }++ /// A descriptor for the regular file at `url` when it is at most `maximum` bytes, which the caller closes.+ private static func openRegularFile(at url: URL, maximum: Int) -> Int32? {+ let descriptor = open(url.path(percentEncoded: false), O_RDONLY | O_NONBLOCK | O_CLOEXEC)+ guard descriptor >= 0 else { return nil }+ var info = stat()+ guard fstat(descriptor, &info) == 0, info.st_mode & S_IFMT == S_IFREG, info.st_size <= maximum else {+ close(descriptor)+ return nil+ }+ return descriptor+ }+static func propertyList(at url: URL, maximum: Int = maximumBytes) -> [String: Any]? {data(at: url, maximum: maximum).flatMap(propertyList(in:))}diff --git a/Packages/PeelCore/Tests/PeelCoreTests/CleanupTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/CleanupTests.swiftindex fd5dfc25..99fc5350 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/CleanupTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/CleanupTests.swift@@ -38,6 +38,24 @@ struct CleanupTests {#expect(plan.total.known == 20)}+ /// While History cannot be read nothing moves, and the command says so above the list, with the way out.+ @Test func saysSoWhenHistoryCannotBeRead() async throws {+ let directory = try TemporaryDirectory()+ let cache = try directory.file("home/Library/Caches/com.example.editor/blob", bytes: 20)+ let history = try directory.file("Peel/removals.json", contents: Data("[]".utf8))+ try directory.setPermissions(0, of: "Peel/removals.json")+ defer { try? directory.setPermissions(0o644, of: "Peel/removals.json") }+ let collected = Output.Collected()++ try await Output.$collected.withValue(collected) {+ try await cleanup(items: [(cache, 20)], service: try service(in: directory))+ .run(question: "?", dryRun: true, yes: true, using: try service(in: directory), recordingIn: RemovalLog(url: history))+ }++ #expect(collected.notes.hasPrefix("Peel couldn't read its History at \(history.path(percentEncoded: false)), so nothing will be moved."))+ #expect(collected.notes.contains("Start Over in History"))+ }+/// The command line never uses the helper, so what needs administrator access stays and says so.@Test func leavesWhatNeedsAdministratorAccessForTheApp() throws {let directory = try TemporaryDirectory()diff --git a/Packages/PeelCore/Tests/PeelCoreTests/RefusalLogTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/RefusalLogTests.swiftindex 9217acf6..8fe2d0fb 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/RefusalLogTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/RefusalLogTests.swift@@ -150,7 +150,7 @@ struct RefusalLogTests {private static let everyReason: [TrashFailure.Reason] = [.protectedLocation, .changedSinceScan, .claimedSinceScan, .lastCopy, .notPermitted, .needsHelper,- .movedWithoutATrace, .somethingElseMoved(named: "x 2"), .failed("x"),+ .movedWithoutATrace, .somethingElseMoved(named: "x 2"), .historyUnreadable, .failed("x"),]/// A record stores its reason as a word, not a sentence, so a later version of Peel can still read it.diff --git a/Packages/PeelCore/Tests/PeelCoreTests/RemovalHistoryTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/RemovalHistoryTests.swiftindex 021ae6c5..5706fe8b 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/RemovalHistoryTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/RemovalHistoryTests.swift@@ -289,6 +289,46 @@ struct RemovalHistoryTests {#expect(outcome.problem == .unreadable)}+ /// Whether History can be read is known without reading it, so a removal can be refused before anything moves:+ /// a History not written yet can be, one Peel cannot open, or in a folder Peel cannot search, cannot.+ @Test func whetherHistoryCanBeReadIsKnownBeforeAMove() throws {+ let directory = try TemporaryDirectory()+ let url = directory.url.appending(path: "Peel/removals.json")+ #expect(RemovalLog.canBeRead(at: url), "a History not written yet")++ _ = try directory.file("Peel/removals.json", contents: Data("[]".utf8))+ #expect(RemovalLog.canBeRead(at: url))++ try directory.setPermissions(0, of: "Peel/removals.json")+ #expect(!RemovalLog.canBeRead(at: url), "a file Peel cannot open")+ try directory.setPermissions(0o644, of: "Peel/removals.json")++ try directory.setPermissions(0o600, of: "Peel")+ defer { try? directory.setPermissions(0o755, of: "Peel") }+ #expect(!RemovalLog.canBeRead(at: url), "a folder Peel cannot search")+ }++ /// Starting over keeps a History Peel cannot read beside the new one, under another name, and records again.+ @Test func startingOverKeepsAHistoryItCannotReadAside() async throws {+ let directory = try TemporaryDirectory()+ let url = try directory.file("Peel/removals.json", contents: Data("[]".utf8))+ try directory.setPermissions(0, of: "Peel/removals.json")+ let log = RemovalLog(url: url)+ #expect(await log.load().problem == .unreadable)++ let outcome = await log.startOver()++ let folder = directory.url.appending(path: "Peel").path(percentEncoded: false)+ let kept = try FileManager.default.contentsOfDirectory(atPath: folder).filter { $0.hasPrefix("removals-damaged-") }+ for name in kept {+ try directory.setPermissions(0o644, of: "Peel/\(name)")+ }+ #expect(kept.count == 1, "the old file was not kept beside the new one")+ #expect(outcome.records == [])+ #expect(outcome.problem == nil)+ #expect(await log.add([Self.record(batch: UUID())]).records?.count == 1)+ }+/// A log in a folder that cannot be searched is not known to be empty, so it is unreadable, never replaced.@Test func aLogItCannotReachIsUnreadableNotEmpty() async throws {let directory = try TemporaryDirectory()diff --git a/Packages/PeelCore/Tests/PeelCoreTests/RemovalJournalTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/RemovalJournalTests.swiftindex 72013268..33f3a5ae 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/RemovalJournalTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/RemovalJournalTests.swift@@ -119,6 +119,32 @@ struct RemovalJournalTests {#expect(Set(journal.entries().map(\.item.trashedURL)) == Set(result.trashed.map(\.trashedURL)))}+ /// While History cannot be read nothing moves, since what moved could not be listed for Put Back. An item the+ /// guard refuses keeps that reason, and Peel's own files, which History never lists, still go.+ @Test func nothingMovesWhileHistoryCannotBeRead() async throws {+ let directory = try TemporaryDirectory()+ let history = try directory.file("home/Library/Application Support/Peel/removals.json", contents: Data("[]".utf8))+ try directory.setPermissions(0, of: "home/Library/Application Support/Peel/removals.json")+ defer { try? directory.setPermissions(0o644, of: "home/Library/Application Support/Peel/removals.json") }+ let item = try directory.file("home/Library/Caches/com.example.app/cache.db").deletingLastPathComponent()+ let keychains = try directory.directory("home/Library/Keychains")+ let moved = Mutex<[URL]>([])+ let service = service(in: directory, journal: RemovalJournal(beside: history)) { url in+ moved.withLock { $0.append(url) }+ return directory.url.appending(path: "home/.Trash/\(url.lastPathComponent)")+ }++ #expect(service.refusal(of: item) == .historyUnreadable)+ #expect(service.refusal(of: keychains) == .protectedLocation)+ let result = await service.trash([item, keychains])+ let throughTheHelper = await service.trash([item], usingHelperFor: [item])++ #expect(moved.withLock { $0 }.isEmpty)+ #expect(result.failures.map(\.reason) == [.historyUnreadable, .protectedLocation])+ #expect(throughTheHelper.failures.map(\.reason) == [.historyUnreadable])+ #expect(await service.trashOwnFiles([item]).trashed.count == 1, "Peel's own files waited for History")+ }+/// Peel's folder holds the journal, and Peel moves it last as it removes itself: that move is not written/// down, since History went with the folder and writing the line would make the folder again.@Test func theMoveOfTheFolderThatHoldsTheJournalMakesNothingAgain() async throws {diff --git a/Peel/Model/RemovalHistoryStore.swift b/Peel/Model/RemovalHistoryStore.swiftindex 2353538a..29c766db 100644--- a/Peel/Model/RemovalHistoryStore.swift+++ b/Peel/Model/RemovalHistoryStore.swift@@ -114,6 +114,9 @@ final class RemovalHistoryStore {private(set) var refusalBatches: [RefusalBatch] = []private(set) var refusalSearchKeys: [RefusalBatch.ID: String] = [:]private(set) var problem: RemovalLogProblem?+ /// Whether History cannot be read, which holds every removal back, as the Trash service does. Known without+ /// reading it: at launch, when Peel comes forward, and with every read or change of History.+ private(set) var isUnreadable = falseprivate(set) var isRestoring = falsevar selection: RemovalBatch.ID?/// By record, not by path: Space and Developer move the same cache folders again and again, so one path@@ -141,6 +144,22 @@ final class RemovalHistoryStore {await loadRefusals()}+ /// The problem History's page shows: that History cannot be read, as soon as that is known, otherwise what the+ /// last read or change of it met.+ var shownProblem: RemovalLogProblem? {+ isUnreadable ? .unreadable : problem+ }++ /// Looks again at whether History can be read, which costs no read of it.+ func checkReadability() {+ isUnreadable = !RemovalLog.canBeRead(at: log.url)+ }++ /// Keeps a History that cannot be read beside a new one, and records again.+ func startOver() async {+ apply(await log.startOver())+ }+private func loadRefusals() async {refusalBatches = RefusalRecord.grouped(await refusals.load()).map(RefusalBatch.init)refusalSearchKeys = Dictionary(uniqueKeysWithValues: refusalBatches.map {@@ -171,6 +190,7 @@ final class RemovalHistoryStore {if !result.failures.isEmpty {await loadRefusals()}+ checkReadability()}/// Tells what `removal` moved once every part of it is recorded: the bar's "Moved", VoiceOver, the lifetime@@ -218,6 +238,7 @@ final class RemovalHistoryStore {})}problem = outcome.problem+ checkReadability()hasLoaded = true}diff --git a/Peel/PeelApp.swift b/Peel/PeelApp.swiftindex b3ff82d2..b6f6dd32 100644--- a/Peel/PeelApp.swift+++ b/Peel/PeelApp.swift@@ -129,6 +129,8 @@ struct PeelApp: App {helper.refresh()// `peel exclusions` may have changed the list while another app was in front.Task { await exclusions.load() }+ // History may have become readable again meanwhile, or stopped being.+ history.checkReadability()// Home's checks run again whatever page is showing: permissions change in System Settings, and the// badge on Home in the sidebar shows a missing one.Task { await home.refresh(helper: helper) }@@ -255,6 +257,7 @@ struct PeelApp: App {guard !hasLaunched else { return }hasLaunched = truehistory.stats = stats+ history.checkReadability()// Read beside the rest and behind nothing: until the exclusions are read, nothing moves.async let exclusionsRead: Void = Marks.interval("Exclusions") { await exclusions.load() }// The apps and Homebrew don't depend on Home's checks, so they load in parallel with them.diff --git a/Peel/Views/AppDetailView.swift b/Peel/Views/AppDetailView.swiftindex 2f50e2b0..c79efe6a 100644--- a/Peel/Views/AppDetailView.swift+++ b/Peel/Views/AppDetailView.swift@@ -115,7 +115,7 @@ struct AppDetailView: View {}.listRowSeparator(.hidden)- ExclusionsUnreadableBanner()+ RemovalsHeldBanner()if plan.isExcluded {Notice(title: Text("This app is excluded"),diff --git a/Peel/Views/BackgroundItems/BackgroundItemDetailView.swift b/Peel/Views/BackgroundItems/BackgroundItemDetailView.swiftindex 6cda4282..e1585edf 100644--- a/Peel/Views/BackgroundItems/BackgroundItemDetailView.swift+++ b/Peel/Views/BackgroundItems/BackgroundItemDetailView.swift@@ -124,7 +124,7 @@ struct BackgroundItemDetailView: View {if hasOwnControls || finderURL != nil {Section {if item.canMoveToTrash {- ExclusionsUnreadableBanner()+ RemovalsHeldBanner()}controls}@@ -304,7 +304,7 @@ struct BackgroundItemDetailView: View {isConfirmingTrash = true}.buttonStyle(.borderedProminent)- .disabled(isBusy || item.removalRequiresPrivileges && !helper.canAct || !exclusions.exclusions.isKnown)+ .disabled(isBusy || item.removalRequiresPrivileges && !helper.canAct || !exclusions.exclusions.isKnown || history.isUnreadable)}}diff --git a/Peel/Views/Cloud/CloudView.swift b/Peel/Views/Cloud/CloudView.swiftindex ab5a4cf7..7bd8b19a 100644--- a/Peel/Views/Cloud/CloudView.swift+++ b/Peel/Views/Cloud/CloudView.swift@@ -21,7 +21,7 @@ struct CloudView: View {List {header.listRowSeparator(.hidden)- ExclusionsUnreadableBanner()+ RemovalsHeldBanner()if !listed.isEmpty {Section {diff --git a/Peel/Views/Developer/DeveloperDetailView.swift b/Peel/Views/Developer/DeveloperDetailView.swiftindex 8224aecb..4648d3b1 100644--- a/Peel/Views/Developer/DeveloperDetailView.swift+++ b/Peel/Views/Developer/DeveloperDetailView.swift@@ -9,7 +9,7 @@ struct DeveloperDetailView: View {List {header.listRowSeparator(.hidden)- ExclusionsUnreadableBanner()+ RemovalsHeldBanner()Section {ForEach(Array(environment.locations.enumerated()), id: \.element.id) { index, location indiff --git a/Peel/Views/Duplicates/DuplicateFolderGroupView.swift b/Peel/Views/Duplicates/DuplicateFolderGroupView.swiftindex 12a9a981..d729c6fd 100644--- a/Peel/Views/Duplicates/DuplicateFolderGroupView.swift+++ b/Peel/Views/Duplicates/DuplicateFolderGroupView.swift@@ -13,7 +13,7 @@ struct DuplicateFolderGroupView: View {List {header.listRowSeparator(.hidden)- ExclusionsUnreadableBanner()+ RemovalsHeldBanner()Section {ForEach(Array(group.folders.enumerated()), id: \.element.id) { index, folder indiff --git a/Peel/Views/Duplicates/DuplicateGroupView.swift b/Peel/Views/Duplicates/DuplicateGroupView.swiftindex 9d25d9f3..62aeebb7 100644--- a/Peel/Views/Duplicates/DuplicateGroupView.swift+++ b/Peel/Views/Duplicates/DuplicateGroupView.swift@@ -16,7 +16,7 @@ struct DuplicateGroupView: View {List {header.listRowSeparator(.hidden)- ExclusionsUnreadableBanner()+ RemovalsHeldBanner()Section {ForEach(Array(group.files.enumerated()), id: \.element.id) { index, file indiff --git a/Peel/Views/Duplicates/DuplicateStatusViews.swift b/Peel/Views/Duplicates/DuplicateStatusViews.swiftindex 5e30669a..a5f87e29 100644--- a/Peel/Views/Duplicates/DuplicateStatusViews.swift+++ b/Peel/Views/Duplicates/DuplicateStatusViews.swift@@ -66,7 +66,7 @@ struct DuplicateSummaryView: View {var body: some View {VStack(spacing: 0) {- ExclusionsUnreadableBanner()+ RemovalsHeldBanner().padding(.horizontal, 20).padding(.top, 12)// Shown only when Full Disk Access would help: it can't fix a folder that is missing, or one thediff --git a/Peel/Views/ExclusionsUnreadableBanner.swift b/Peel/Views/ExclusionsUnreadableBanner.swiftdeleted file mode 100644index 945f495e..00000000--- a/Peel/Views/ExclusionsUnreadableBanner.swift+++ /dev/null@@ -1,23 +0,0 @@-import PeelCore-import SwiftUI--/// Over a page that can move something to the Trash or put it back, while the exclusions can't be read: the-/// guard moves nothing until they can, so the page's own button is off, and this says why. It shows only then.-struct ExclusionsUnreadableBanner: View {- @Environment(ExclusionsStore.self) private var exclusions-- var body: some View {- if exclusions.exclusions.isUnreadable {- Notice(- title: Text("Peel couldn’t read your exclusions"),- detail: Text("Peel removes nothing and puts nothing back until you start the list over in Settings.")- ) {- SettingsLink {- Text("Open Peel Settings")- }- }- .padding(.vertical, 6)- .listRowSeparator(.hidden)- }- }-}diff --git a/Peel/Views/FileSearch/FileSearchList.swift b/Peel/Views/FileSearch/FileSearchList.swiftindex 725e4bde..be486529 100644--- a/Peel/Views/FileSearch/FileSearchList.swift+++ b/Peel/Views/FileSearch/FileSearchList.swift@@ -12,7 +12,7 @@ struct FileSearchList: View {@Bindable var search = searchList(selection: $search.chosen) {- ExclusionsUnreadableBanner()+ RemovalsHeldBanner()// Says the limit rather than counting the rows, since exclusions added after the search take files// out of the list, and can empty it, while the rest stays unlisted.if search.results?.isTruncated == true {diff --git a/Peel/Views/History/HistoryDetailView.swift b/Peel/Views/History/HistoryDetailView.swiftindex 02886080..90abe7ce 100644--- a/Peel/Views/History/HistoryDetailView.swift+++ b/Peel/Views/History/HistoryDetailView.swift@@ -67,7 +67,7 @@ struct HistoryDetailView: View {List {header.listRowSeparator(.hidden)- ExclusionsUnreadableBanner()+ RemovalsHeldBanner(isOnHistoryPage: true)// The records appear only once the disk has answered, so no row changes after it is drawn.if let standing {@@ -78,7 +78,7 @@ struct HistoryDetailView: View {RestoreBar(count: selected.count,isRestoring: history.isRestoring,- isEnabled: !selected.isEmpty && !history.isRestoring && exclusions.exclusions.isKnown+ isEnabled: !selected.isEmpty && !history.isRestoring && exclusions.exclusions.isKnown && !history.isUnreadable) {Task { await history.restore(selected, canUseHelper: helper.canAct) }}diff --git a/Peel/Views/History/HistoryList.swift b/Peel/Views/History/HistoryList.swiftindex c3559553..084a40f9 100644--- a/Peel/Views/History/HistoryList.swift+++ b/Peel/Views/History/HistoryList.swift@@ -44,14 +44,14 @@ struct HistoryList: View {.columnSearch(text: $searchText, prompt: "Search History", when: !history.batches.isEmpty || !history.refusalBatches.isEmpty).safeAreaBar(edge: .top) {Group {- if let problem = history.problem {+ if let problem = history.shownProblem {HistoryProblemNotice(problem: problem).padding(.horizontal, 12).padding(.bottom, 8).transition(.opacity)}}- .motion(.settle, .movement, value: history.problem != nil)+ .motion(.settle, .movement, value: history.shownProblem != nil)}.overlay {if history.batches.isEmpty, history.refusalBatches.isEmpty, history.hasLoaded {@@ -81,6 +81,7 @@ struct HistoryList: View {}private struct HistoryProblemNotice: View {+ @Environment(RemovalHistoryStore.self) private var historylet problem: RemovalLogProblemvar body: some View {@@ -97,8 +98,12 @@ private struct HistoryProblemNotice: View {case .unreadable:Notice(title: Text("The record of past removals can’t be read"),- detail: Text("Peel isn’t recording new removals, so it doesn’t overwrite what is there.")- ) { EmptyView() }+ detail: Text("Until it can read the record, or you start over, Peel removes nothing, because anything it moved now couldn’t be put back. Starting over keeps the old file beside a new one.")+ ) {+ Button("Start Over") {+ Task { await history.startOver() }+ }+ }case .couldNotRecord:Notice(title: Text("The last removal couldn’t be recorded"),diff --git a/Peel/Views/Installers/InstallerDetailView.swift b/Peel/Views/Installers/InstallerDetailView.swiftindex 14d3d450..4b53a9c3 100644--- a/Peel/Views/Installers/InstallerDetailView.swift+++ b/Peel/Views/Installers/InstallerDetailView.swift@@ -14,7 +14,7 @@ struct InstallerDetailView: View {List {header(rows).listRowSeparator(.hidden)- ExclusionsUnreadableBanner()+ RemovalsHeldBanner()if rows.contains(where: \.requiresPrivileges), !helper.canAct {HelperRequiredBanner()diff --git a/Peel/Views/MultipleAppsView.swift b/Peel/Views/MultipleAppsView.swiftindex 9bb6c215..9b085fb3 100644--- a/Peel/Views/MultipleAppsView.swift+++ b/Peel/Views/MultipleAppsView.swift@@ -21,7 +21,7 @@ struct MultipleAppsView: View {List {header.listRowSeparator(.hidden)- ExclusionsUnreadableBanner()+ RemovalsHeldBanner()if plan.bulk != nil {if !plan.unreadableLocations.isEmpty {diff --git a/Peel/Views/Orphans/OrphanDetailView.swift b/Peel/Views/Orphans/OrphanDetailView.swiftindex 1c0472f6..f2fabb47 100644--- a/Peel/Views/Orphans/OrphanDetailView.swift+++ b/Peel/Views/Orphans/OrphanDetailView.swift@@ -10,7 +10,7 @@ struct OrphanDetailView: View {List {header.listRowSeparator(.hidden)- ExclusionsUnreadableBanner()+ RemovalsHeldBanner()if orphans.scan?.unreadableLocations.isEmpty == false {FullDiskAccessBanner()diff --git a/Peel/Views/Packages/PackageDetailView.swift b/Peel/Views/Packages/PackageDetailView.swiftindex 1e7068be..fafd3f5c 100644--- a/Peel/Views/Packages/PackageDetailView.swift+++ b/Peel/Views/Packages/PackageDetailView.swift@@ -14,7 +14,7 @@ struct PackageDetailView: View {List {header.listRowSeparator(.hidden)- ExclusionsUnreadableBanner()+ RemovalsHeldBanner()if receipt.items.contains(where: { $0.requiresPrivileges && !$0.isLeftAlone }), !helper.canAct {HelperRequiredBanner()diff --git a/Peel/Views/Plugins/PluginDetailView.swift b/Peel/Views/Plugins/PluginDetailView.swiftindex 065e8ac9..0009e218 100644--- a/Peel/Views/Plugins/PluginDetailView.swift+++ b/Peel/Views/Plugins/PluginDetailView.swift@@ -71,7 +71,7 @@ struct PluginDetailView: View {}Section {- ExclusionsUnreadableBanner()+ RemovalsHeldBanner()if plugin.isLeftAlone {Text("Peel won’t move this: it is protected, or your exclusions in Settings keep it where it is.").font(.callout)@@ -86,7 +86,7 @@ struct PluginDetailView: View {isConfirmingRemoval = true}.buttonStyle(.borderedProminent)- .disabled(isLocked || plugin.isLeftAlone || plugins.isRemoving || plugins.isScanning || !exclusions.exclusions.isKnown)+ .disabled(isLocked || plugin.isLeftAlone || plugins.isRemoving || plugins.isScanning || !exclusions.exclusions.isKnown || history.isUnreadable)}}}diff --git a/Peel/Views/Presentation.swift b/Peel/Views/Presentation.swiftindex 03d675f4..b8c110b9 100644--- a/Peel/Views/Presentation.swift+++ b/Peel/Views/Presentation.swift@@ -115,6 +115,7 @@ extension TrashFailure.Reason {case .needsHelper: String(localized: "It needs administrator access, which Peel’s helper provides.")case .movedWithoutATrace: String(localized: "It is in the Trash, but macOS didn’t say where, so it can only be put back from Finder.")case .somethingElseMoved(let name): String(localized: "Something else was at that path by the time it moved. It is in the Trash as \(name), and Finder can put it back.")+ case .historyUnreadable: String(localized: "Peel couldn’t read History, and it moves nothing it can’t put back.")case .failed(let message): FixedSentence.translated(message)}}diff --git a/Peel/Views/Projects/ProjectDetailView.swift b/Peel/Views/Projects/ProjectDetailView.swiftindex 6bd58327..e9046eab 100644--- a/Peel/Views/Projects/ProjectDetailView.swift+++ b/Peel/Views/Projects/ProjectDetailView.swift@@ -9,7 +9,7 @@ struct ProjectDetailView: View {List {header.listRowSeparator(.hidden)- ExclusionsUnreadableBanner()+ RemovalsHeldBanner()Section {ForEach(Array(group.artifacts.enumerated()), id: \.element.id) { index, artifact indiff --git a/Peel/Views/RemovalBar.swift b/Peel/Views/RemovalBar.swiftindex a8356f40..d4d90d15 100644--- a/Peel/Views/RemovalBar.swift+++ b/Peel/Views/RemovalBar.swift@@ -90,7 +90,7 @@ struct RemovalBar: View {var body: some View {let reading = reading- let isEnabled = reading.isEnabled && exclusions.exclusions.isKnown+ let isEnabled = reading.isEnabled && exclusions.exclusions.isKnown && !history.isUnreadableFloatingBar {if let notice {Text(verbatim: notice.figure)diff --git a/Peel/Views/RemovalsHeldBanner.swift b/Peel/Views/RemovalsHeldBanner.swiftnew file mode 100644index 00000000..c289ddaf--- /dev/null+++ b/Peel/Views/RemovalsHeldBanner.swift@@ -0,0 +1,37 @@+import PeelCore+import SwiftUI++/// Over a page that can move something to the Trash or put it back, while the exclusions or History can't be+/// read: nothing moves until they can, so the page's own button is off, and this says why. It shows only then.+struct RemovalsHeldBanner: View {+ @Environment(ExclusionsStore.self) private var exclusions+ @Environment(RemovalHistoryStore.self) private var history+ /// On History's own page, whose list says it with Start Over beside it, History is left unsaid here.+ var isOnHistoryPage = false++ var body: some View {+ if exclusions.exclusions.isUnreadable {+ Notice(+ title: Text("Peel couldn’t read your exclusions"),+ detail: Text("Peel removes nothing and puts nothing back until you start the list over in Settings.")+ ) {+ SettingsLink {+ Text("Open Peel Settings")+ }+ }+ .padding(.vertical, 6)+ .listRowSeparator(.hidden)+ } else if history.isUnreadable, !isOnHistoryPage {+ Notice(+ title: Text("Peel couldn’t read History"),+ detail: Text("Peel removes nothing until you start History over, so that everything it moves can be put back.")+ ) {+ Button("Open History") {+ Navigator.shared.requestedTool = .history+ }+ }+ .padding(.vertical, 6)+ .listRowSeparator(.hidden)+ }+ }+}diff --git a/Peel/Views/Space/SpaceDetailView.swift b/Peel/Views/Space/SpaceDetailView.swiftindex a5a3f344..7145f82e 100644--- a/Peel/Views/Space/SpaceDetailView.swift+++ b/Peel/Views/Space/SpaceDetailView.swift@@ -19,7 +19,7 @@ struct SpaceDetailView: View {List {header.listRowSeparator(.hidden)- ExclusionsUnreadableBanner()+ RemovalsHeldBanner()Section {Text(item.words.detail)diff --git a/SAFETY.md b/SAFETY.mdindex 5a0a30c6..10885c33 100644--- a/SAFETY.md+++ b/SAFETY.md@@ -122,7 +122,9 @@ default. Forgetting a preference domain (described above) is not one of the threis in the Trash, and putting the file back undoes it, until the app writes its settings again.If the record itself is damaged, it is set aside under another name rather than overwritten, because it is-the only way back from a removal.+the only way back from a removal. If it can't be read at all, Peel moves nothing until it can, or until you+start it over in History, which keeps the old file beside the new one: what moved meanwhile couldn't be put+back. The `peel` command says so and moves nothing either.The record is also a file any process running as you can rewrite, so Put Back reads it as a request, not asa fact. It only takes something that really sits in a Trash of yours (`~/.Trash`, or `.Trashes/<uid>` at the