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.

A refusal names the rule that kept the item

Țugui Dragoșbe90450c593e
diff --git a/Localization/Peel/Localizable.xcstrings b/Localization/Peel/Localizable.xcstrings
index 6bed412d..8a5c2724 100644
--- a/Localization/Peel/Localizable.xcstrings
+++ b/Localization/Peel/Localizable.xcstrings
@@ -54603,112 +54603,6 @@
}
}
},
- "Left alone: Peel won’t move this, because of where it sits or what is inside it." : {
- "localizations" : {
- "cs" : {
- "stringUnit" : {
- "state" : "translated",
- "value" : "Nedotčeno: Peel tuto položku nepřesune kvůli tomu, kde leží nebo co obsahuje."
- }
- },
- "de" : {
- "stringUnit" : {
- "state" : "translated",
- "value" : "Unangetastet: Peel verschiebt dies wegen seines Speicherorts oder seines Inhalts nicht."
- }
- },
- "es" : {
- "stringUnit" : {
- "state" : "translated",
- "value" : "No se toca: Peel no trasladará esto por el lugar donde está o por lo que contiene."
- }
- },
- "fr" : {
- "stringUnit" : {
- "state" : "translated",
- "value" : "Laissé en place : Peel refuse de déplacer cet élément, en raison de son emplacement ou de son contenu."
- }
- },
- "it" : {
- "stringUnit" : {
- "state" : "translated",
- "value" : "Resta dov’è: Peel non lo sposta, per il posto in cui si trova o per ciò che contiene."
- }
- },
- "ja" : {
- "stringUnit" : {
- "state" : "translated",
- "value" : "対象外: 置かれている場所や中身のため、Peelはこれを移動しません。"
- }
- },
- "ko" : {
- "stringUnit" : {
- "state" : "translated",
- "value" : "그대로 둠: 위치나 내용 때문에 Peel이 이 항목을 이동하지 않습니다."
- }
- },
- "nl" : {
- "stringUnit" : {
- "state" : "translated",
- "value" : "Blijft staan: Peel verplaatst dit niet, vanwege de plek waar het staat of wat erin zit."
- }
- },
- "pl" : {
- "stringUnit" : {
- "state" : "translated",
- "value" : "Nietknięte: Peel tego nie przeniesie ze względu na to, gdzie się znajduje lub co zawiera."
- }
- },
- "pt" : {
- "stringUnit" : {
- "state" : "translated",
- "value" : "Preservado: o Peel não vai mover isto, por causa do lugar onde está ou do que há dentro."
- }
- },
- "ro" : {
- "stringUnit" : {
- "state" : "translated",
- "value" : "Lăsat neatins: Peel nu mută acest articol, din cauza locului în care se află sau a ceea ce conține."
- }
- },
- "ru" : {
- "stringUnit" : {
- "state" : "translated",
- "value" : "Остается на месте: Peel не станет перемещать этот объект из-за того, где он находится или что в нем."
- }
- },
- "sv" : {
- "stringUnit" : {
- "state" : "translated",
- "value" : "Rörs inte: Peel flyttar inte det här, på grund av var det ligger eller vad det innehåller."
- }
- },
- "tr" : {
- "stringUnit" : {
- "state" : "translated",
- "value" : "Yerinde kalır: Peel bunu, bulunduğu yer veya içindekiler nedeniyle taşımaz."
- }
- },
- "uk" : {
- "stringUnit" : {
- "state" : "translated",
- "value" : "Лишається на місці: Peel не перемістить цей елемент через його розташування або вміст."
- }
- },
- "zh-Hans" : {
- "stringUnit" : {
- "state" : "translated",
- "value" : "留在原处:由于它所在的位置或其中的内容,Peel不会移动它。"
- }
- },
- "zh-Hant" : {
- "stringUnit" : {
- "state" : "translated",
- "value" : "原地保留:由於它所在的位置或其中的內容,Peel不會移動此項目。"
- }
- }
- }
- },
"Left alone: a photo, music, or video library is inside, so Peel leaves this folder where it is." : {
"localizations" : {
"cs" : {
@@ -92769,6 +92663,642 @@
}
}
},
+ "Peel won’t move this folder itself, since macOS expects to find it. What is inside it can go." : {
+ "localizations" : {
+ "cs" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel samotnou tuto složku nepřesune, protože macOS počítá s tím, že ji najde. Její obsah přesunout lze."
+ }
+ },
+ "de" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel verschiebt diesen Ordner selbst nicht, da macOS erwartet, ihn vorzufinden. Was darin liegt, kann in den Papierkorb gelegt werden."
+ }
+ },
+ "es" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel no trasladará esta carpeta en sí, porque macOS espera encontrarla. Lo que hay dentro sí puede trasladarse."
+ }
+ },
+ "fr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel refuse de déplacer ce dossier lui-même, car macOS s’attend à le trouver. Son contenu, lui, peut être déplacé."
+ }
+ },
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel non sposta questa cartella in sé, perché macOS si aspetta di trovarla. Ciò che contiene può essere spostato."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peelはこのフォルダ自体は移動しません。macOSがそこにあるものと想定しているためです。中にあるものはゴミ箱に入れることができます。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel이 이 폴더 자체는 이동하지 않습니다. macOS가 이 폴더를 찾을 수 있어야 하기 때문입니다. 안에 있는 항목은 이동할 수 있습니다."
+ }
+ },
+ "nl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel verplaatst deze map zelf niet, want macOS verwacht hem daar te vinden. Wat erin zit, mag weg."
+ }
+ },
+ "pl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel nie przeniesie samego tego folderu, ponieważ macOS oczekuje, że go tu znajdzie. To, co jest w środku, może trafić do Kosza."
+ }
+ },
+ "pt" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "O Peel não vai mover esta pasta em si, porque o macOS espera encontrá-la. O que está dentro dela pode ir."
+ }
+ },
+ "ro" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel nu mută acest dosar în sine, deoarece macOS se așteaptă să îl găsească. Ce se află în el poate fi mutat."
+ }
+ },
+ "ru" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel не будет перемещать саму эту папку, так как macOS рассчитывает ее найти. Ее содержимое можно переместить."
+ }
+ },
+ "sv" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel flyttar inte själva mappen, eftersom macOS räknar med att hitta den. Det som ligger i den kan flyttas."
+ }
+ },
+ "tr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel bu klasörün kendisini taşımaz, çünkü macOS onu orada bulmayı bekler. İçindekiler gidebilir."
+ }
+ },
+ "uk" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel не перемістить саму цю папку, бо macOS очікує її там знайти. Те, що в ній є, можна перемістити."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel不会移动此文件夹本身,因为macOS需要它存在。其中的内容可以移走。"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel不會移動此檔案夾本身,因為macOS預期它存在。其中的內容則可以移動。"
+ }
+ }
+ }
+ },
+ "Peel won’t move this until it can read your exclusions." : {
+ "localizations" : {
+ "cs" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel tuto položku nepřesune, dokud nebude moci přečíst vaše výjimky."
+ }
+ },
+ "de" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel verschiebt dies nicht, solange Peel deine Ausschlüsse nicht lesen kann."
+ }
+ },
+ "es" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel no trasladará esto hasta que pueda leer tus exclusiones."
+ }
+ },
+ "fr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel refuse de déplacer cet élément tant qu’il ne peut pas lire vos exclusions."
+ }
+ },
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel non lo sposta finché non riesce a leggere le tue esclusioni."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peelは、除外リストを読み取れるまでこれを移動しません。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel이 이 항목을 이동하지 않습니다. 먼저 제외 항목을 읽을 수 있어야 합니다."
+ }
+ },
+ "nl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel verplaatst dit niet zolang het je uitsluitingen niet kan lezen."
+ }
+ },
+ "pl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel tego nie przeniesie, dopóki nie odczyta Twoich wykluczeń."
+ }
+ },
+ "pt" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "O Peel não vai mover isto até conseguir ler as suas exclusões."
+ }
+ },
+ "ro" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel nu mută acest articol până când nu poate citi lista dvs. de excluderi."
+ }
+ },
+ "ru" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel не будет это перемещать, пока не сможет прочитать Ваши исключения."
+ }
+ },
+ "sv" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel flyttar inte det här förrän appen kan läsa dina undantag."
+ }
+ },
+ "tr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel bunu, hariç tutulanlar listenizi okuyabilene kadar taşımaz."
+ }
+ },
+ "uk" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel не перемістить це, доки не зможе прочитати ваші винятки."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel不会移动此项,直到它能读取你的排除项为止。"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel不會移動此項目,直到它能讀取你的排除項目為止。"
+ }
+ }
+ }
+ },
+ "Peel won’t move this: a photo, music, or video library is inside." : {
+ "localizations" : {
+ "cs" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel tuto položku nepřesune: uvnitř je knihovna fotek, hudby nebo videí."
+ }
+ },
+ "de" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel verschiebt dies nicht: Darin liegt eine Foto-, Musik- oder Videomediathek."
+ }
+ },
+ "es" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel no trasladará esto: dentro hay una biblioteca de fotos, música o vídeo."
+ }
+ },
+ "fr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel refuse de déplacer cet élément : il contient une bibliothèque de photos, de musique ou de vidéos."
+ }
+ },
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel non lo sposta: all’interno c’è una libreria di foto, musica o video."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peelはこれを移動しません。写真、音楽、またはビデオのライブラリが中にあります。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel이 이 항목을 이동하지 않습니다. 안에 사진, 음악 또는 비디오 보관함이 있기 때문입니다."
+ }
+ },
+ "nl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel verplaatst dit niet: er zit een foto-, muziek- of videobibliotheek in."
+ }
+ },
+ "pl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel tego nie przeniesie: w środku jest biblioteka zdjęć, muzyki lub wideo."
+ }
+ },
+ "pt" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "O Peel não vai mover isto: há dentro uma biblioteca de fotos, músicas ou vídeos."
+ }
+ },
+ "ro" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel nu mută acest articol: înăuntru se află o bibliotecă foto, muzicală sau video."
+ }
+ },
+ "ru" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel не будет это перемещать: внутри находится медиатека фото, музыки или видео."
+ }
+ },
+ "sv" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel flyttar inte det här: ett bild-, musik- eller videobibliotek ligger i det."
+ }
+ },
+ "tr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel bunu taşımaz: içinde bir fotoğraf, müzik veya video arşivi var."
+ }
+ },
+ "uk" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel не перемістить це: усередині є медіатека фото, музики чи відео."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel不会移动此项:其中有照片、音乐或视频资料库。"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel不會移動此項目:其中有照片、音樂或影片資料庫。"
+ }
+ }
+ }
+ },
+ "Peel won’t move this: an app keeps work inside that exists nowhere else, such as an editor’s local history." : {
+ "localizations" : {
+ "cs" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel tuto položku nepřesune: aplikace v ní uchovává práci, která neexistuje nikde jinde, například místní historii editoru."
+ }
+ },
+ "de" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel verschiebt dies nicht: Eine App bewahrt darin Arbeit auf, die es nirgendwo sonst gibt, etwa den lokalen Verlauf eines Editors."
+ }
+ },
+ "es" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel no trasladará esto: una app guarda dentro trabajo que no existe en ningún otro sitio, como el historial local de un editor."
+ }
+ },
+ "fr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel refuse de déplacer cet élément : une app y conserve du travail qui n’existe nulle part ailleurs, comme l’historique local d’un éditeur."
+ }
+ },
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel non lo sposta: un’app vi conserva un lavoro che non esiste altrove, come la cronologia locale di un editor."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peelはこれを移動しません。エディタのローカル履歴など、ほかのどこにも存在しない作業内容をアプリが中に保管しています。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel이 이 항목을 이동하지 않습니다. 편집기의 로컬 기록처럼 다른 곳에는 없는 작업을 앱이 안에 보관하기 때문입니다."
+ }
+ },
+ "nl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel verplaatst dit niet: een app bewaart er werk in dat nergens anders bestaat, zoals de lokale geschiedenis van een editor."
+ }
+ },
+ "pl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel tego nie przeniesie: aplikacja przechowuje w środku pracę, której nie ma nigdzie indziej, na przykład lokalną historię edytora."
+ }
+ },
+ "pt" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "O Peel não vai mover isto: um app guarda dentro um trabalho que não existe em nenhum outro lugar, como o histórico local de um editor."
+ }
+ },
+ "ro" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel nu mută acest articol: o aplicație păstrează înăuntru lucrări care nu există nicăieri altundeva, cum ar fi istoricul local al unui editor."
+ }
+ },
+ "ru" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel не будет это перемещать: приложение хранит внутри результаты работы, которых больше нигде нет, например локальную историю редактора."
+ }
+ },
+ "sv" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel flyttar inte det här: en app sparar arbete i det som inte finns någon annanstans, till exempel en kodredigerares lokala historik."
+ }
+ },
+ "tr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel bunu taşımaz: bir uygulama içinde başka hiçbir yerde bulunmayan çalışmalar tutar, örneğin bir düzenleyicinin yerel geçmişi."
+ }
+ },
+ "uk" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel не перемістить це: програма зберігає всередині роботу, якої більше ніде немає, як-от локальну історію редактора."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel不会移动此项:有App在其中保存了在其他任何地方都不存在的内容,例如编辑器的本地历史记录。"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel不會移動此項目:有App在其中保存不存在於其他任何地方的工作成果,例如編輯器的本機歷史記錄。"
+ }
+ }
+ }
+ },
+ "Peel won’t move this: an app’s documents are inside." : {
+ "localizations" : {
+ "cs" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel tuto položku nepřesune: uvnitř jsou dokumenty aplikace."
+ }
+ },
+ "de" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel verschiebt dies nicht: Darin liegen die Dokumente einer App."
+ }
+ },
+ "es" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel no trasladará esto: dentro están los documentos de una app."
+ }
+ },
+ "fr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel refuse de déplacer cet élément : il contient les documents d’une app."
+ }
+ },
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel non lo sposta: all’interno ci sono i documenti di un’app."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peelはこれを移動しません。アプリの書類が中にあります。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel이 이 항목을 이동하지 않습니다. 안에 앱의 문서가 있기 때문입니다."
+ }
+ },
+ "nl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel verplaatst dit niet: er zitten documenten van een app in."
+ }
+ },
+ "pl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel tego nie przeniesie: w środku są dokumenty aplikacji."
+ }
+ },
+ "pt" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "O Peel não vai mover isto: há dentro os documentos de um app."
+ }
+ },
+ "ro" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel nu mută acest articol: înăuntru se află documentele unei aplicații."
+ }
+ },
+ "ru" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel не будет это перемещать: внутри находятся документы приложения."
+ }
+ },
+ "sv" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel flyttar inte det här: en apps dokument ligger i det."
+ }
+ },
+ "tr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel bunu taşımaz: içinde bir uygulamanın belgeleri var."
+ }
+ },
+ "uk" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel не перемістить це: усередині є документи програми."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel不会移动此项:其中有App的文稿。"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel不會移動此項目:其中有App的文件。"
+ }
+ }
+ }
+ },
+ "Peel won’t move this: it is part of macOS, or inside something Peel protects." : {
+ "localizations" : {
+ "cs" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel tuto položku nepřesune: je součástí macOS nebo leží uvnitř něčeho, co Peel chrání."
+ }
+ },
+ "de" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel verschiebt dies nicht: Es ist Teil von macOS oder liegt in etwas, das Peel schützt."
+ }
+ },
+ "es" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel no trasladará esto: forma parte de macOS o está dentro de algo que Peel protege."
+ }
+ },
+ "fr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel refuse de déplacer cet élément : il fait partie de macOS, ou se trouve dans un élément que Peel protège."
+ }
+ },
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel non lo sposta: fa parte di macOS, oppure si trova all’interno di qualcosa che Peel protegge."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peelはこれを移動しません。macOSの一部であるか、Peelが保護しているものの中にあります。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel이 이 항목을 이동하지 않습니다. macOS의 일부이거나 Peel이 보호하는 항목 안에 있기 때문입니다."
+ }
+ },
+ "nl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel verplaatst dit niet: het hoort bij macOS, of het zit in iets wat Peel beschermt."
+ }
+ },
+ "pl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel tego nie przeniesie: jest częścią macOS albo znajduje się w czymś, co Peel chroni."
+ }
+ },
+ "pt" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "O Peel não vai mover isto: faz parte do macOS, ou está dentro de algo que o Peel protege."
+ }
+ },
+ "ro" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel nu mută acest articol: face parte din macOS sau se află în ceva protejat de Peel."
+ }
+ },
+ "ru" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel не будет это перемещать: объект входит в macOS или находится внутри того, что защищает Peel."
+ }
+ },
+ "sv" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel flyttar inte det här: det är en del av macOS, eller ligger i något som Peel skyddar."
+ }
+ },
+ "tr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel bunu taşımaz: macOS’in bir parçası ya da Peel’in koruduğu bir şeyin içinde."
+ }
+ },
+ "uk" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel не перемістить це: елемент є частиною macOS або лежить усередині того, що захищає Peel."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel不会移动此项:它是macOS的一部分,或者位于受Peel保护的项目中。"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel不會移動此項目:它是macOS的一部分,或位於受Peel保護的項目中。"
+ }
+ }
+ }
+ },
"Peel won’t move this: it is protected, or your exclusions in Settings keep it where it is." : {
"localizations" : {
"cs" : {
@@ -92875,6 +93405,218 @@
}
}
},
+ "Peel won’t move this: something Peel protects is inside, such as a keychain or a wallet." : {
+ "localizations" : {
+ "cs" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel tuto položku nepřesune: uvnitř je něco, co Peel chrání, například klíčenka nebo peněženka."
+ }
+ },
+ "de" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel verschiebt dies nicht: Darin liegt etwas, das Peel schützt, etwa ein Schlüsselbund oder eine Wallet."
+ }
+ },
+ "es" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel no trasladará esto: dentro hay algo que Peel protege, como un llavero o un monedero digital."
+ }
+ },
+ "fr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel refuse de déplacer cet élément : il contient un élément que Peel protège, comme un trousseau ou un portefeuille."
+ }
+ },
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel non lo sposta: all’interno c’è qualcosa che Peel protegge, come un portachiavi o un wallet."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peelはこれを移動しません。キーチェーンやウォレットなど、Peelが保護しているものが中にあります。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel이 이 항목을 이동하지 않습니다. 키체인이나 지갑처럼 Peel이 보호하는 항목이 안에 있기 때문입니다."
+ }
+ },
+ "nl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel verplaatst dit niet: er zit iets in wat Peel beschermt, zoals een sleutelhanger of een wallet."
+ }
+ },
+ "pl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel tego nie przeniesie: w środku jest coś, co Peel chroni, na przykład pęk kluczy lub portfel."
+ }
+ },
+ "pt" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "O Peel não vai mover isto: há dentro algo que o Peel protege, como as chaves do macOS ou uma carteira."
+ }
+ },
+ "ro" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel nu mută acest articol: înăuntru se află ceva protejat de Peel, cum ar fi un portchei sau un portofel."
+ }
+ },
+ "ru" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel не будет это перемещать: внутри находится то, что защищает Peel, например связка ключей или кошелек."
+ }
+ },
+ "sv" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel flyttar inte det här: något som Peel skyddar ligger i det, till exempel en nyckelring eller en plånbok."
+ }
+ },
+ "tr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel bunu taşımaz: içinde Peel’in koruduğu bir şey var, örneğin bir anahtar zinciri veya bir cüzdan."
+ }
+ },
+ "uk" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel не перемістить це: усередині є те, що захищає Peel, як-от вʼязка ключів або гаманець."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel不会移动此项:其中有受Peel保护的项目,例如钥匙串或钱包。"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel不會移動此項目:其中有受Peel保護的項目,例如鑰匙圈或錢包。"
+ }
+ }
+ }
+ },
+ "Peel won’t move this: your exclusions in Settings keep it where it is." : {
+ "localizations" : {
+ "cs" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel tuto položku nepřesune: na místě ji drží vaše výjimky v Nastavení."
+ }
+ },
+ "de" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel verschiebt dies nicht: Deine Ausschlüsse in den Einstellungen halten es an seinem Ort."
+ }
+ },
+ "es" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel no trasladará esto: tus exclusiones de Ajustes lo mantienen donde está."
+ }
+ },
+ "fr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel refuse de déplacer cet élément : vos exclusions dans les Réglages le maintiennent en place."
+ }
+ },
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel non lo sposta: le tue esclusioni nelle Impostazioni lo tengono dov’è."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peelはこれを移動しません。“設定”の除外リストによってそのまま残されています。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel이 이 항목을 이동하지 않습니다. 설정의 제외 항목에 따라 그대로 둡니다."
+ }
+ },
+ "nl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel verplaatst dit niet: je uitsluitingen in Instellingen houden het waar het is."
+ }
+ },
+ "pl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel tego nie przeniesie: Twoje wykluczenia w Ustawieniach zatrzymują to na miejscu."
+ }
+ },
+ "pt" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "O Peel não vai mover isto: as suas exclusões nos Ajustes o mantêm onde está."
+ }
+ },
+ "ro" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel nu mută acest articol: excluderile dvs. din Configurări îl păstrează unde se află."
+ }
+ },
+ "ru" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel не будет это перемещать: Ваши исключения в Настройках оставляют его на месте."
+ }
+ },
+ "sv" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel flyttar inte det här: dina undantag i Inställningar håller det kvar där det är."
+ }
+ },
+ "tr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel bunu taşımaz: Ayarlar’daki hariç tutulanlar listeniz onu yerinde tutuyor."
+ }
+ },
+ "uk" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel не перемістить це: ваші винятки в Параметрах тримають його на місці."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel不会移动此项:你在“设置”中的排除项让它保留在原处。"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Peel不會移動此項目:你在「設定」中的排除項目讓它留在原處。"
+ }
+ }
+ }
+ },
"Peel, ^[%lld update](inflect: true) waiting" : {
"localizations" : {
"cs" : {
diff --git a/Packages/PeelCore/Sources/PeelCommandLine/Support/Output.swift b/Packages/PeelCore/Sources/PeelCommandLine/Support/Output.swift
index 907c775e..c0db7706 100644
--- a/Packages/PeelCore/Sources/PeelCommandLine/Support/Output.swift
+++ b/Packages/PeelCore/Sources/PeelCommandLine/Support/Output.swift
@@ -257,6 +257,22 @@ extension MatchConfidence {
}
}
+extension GuardRefusal {
+ /// Why Peel never moves the item, in the command line's plain English.
+ var summary: String {
+ switch self {
+ case .exclusionsNotKnown: "your exclusions couldn't be read"
+ case .excluded: "excluded"
+ case .staysItself: "a folder that stays in place, though what is inside may go"
+ case .protectedLocation: "part of macOS, or inside something Peel protects"
+ case .holdsProtectedData: "holds something Peel protects, such as a keychain or a wallet"
+ case .holdsDocuments: "holds an app's documents"
+ case .holdsALibrary: "holds a photo, music, or video library"
+ case .holdsWorkKeptInACache: "holds work an app keeps nowhere else, such as an editor's local history"
+ }
+ }
+}
+
extension HoldBack {
/// Why the item was held back, the same reason the app's rows give, in the command line's plain English.
var summary: String {
@@ -336,7 +352,7 @@ extension PrivacyReset.Result {
extension TrashFailure.Reason {
var summary: String {
switch self {
- case .protectedLocation: "protected location"
+ case .guarded(let refusal): refusal?.summary ?? "protected location"
case .changedSinceScan: "changed since the scan"
case .claimedSinceScan: "claimed by an app that is installed now"
case .lastCopy: "last copy"
diff --git a/Packages/PeelCore/Sources/PeelCore/Packages/PackageReceipt.swift b/Packages/PeelCore/Sources/PeelCore/Packages/PackageReceipt.swift
index 0f99ebaf..a6d65124 100644
--- a/Packages/PeelCore/Sources/PeelCore/Packages/PackageReceipt.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Packages/PackageReceipt.swift
@@ -14,13 +14,18 @@ public struct PackageReceipt: Sendable, Hashable, Identifiable {
/// Unknown is not the same as empty.
public let size: Int64?
public let requiresPrivileges: Bool
- /// True when Peel never moves this item: `RemovalGuard` refuses it (a file in `/usr/local/bin`, for
- /// example), or it needs an administrator and the helper would refuse it. It is listed but never offered.
- public var isLeftAlone = false
+ /// Why `RemovalGuard` never moves the item, such as a file in `/usr/local/bin`.
+ public var refusal: GuardRefusal?
/// Why the item is left for the person to choose: what measuring it saw (not measured, not read, a wallet,
- /// or a repository), or `/Users/Shared`, which every account on the Mac uses.
+ /// or a repository), or `/Users/Shared`, which every account on the Mac uses. Or why it cannot be moved at
+ /// all: it needs an administrator, and the helper would refuse it.
public var heldBack: HoldBack?
+ /// True when Peel never moves this item. It is listed but never offered.
+ public var isLeftAlone: Bool {
+ refusal != nil || heldBack?.cannotBeMoved == true
+ }
+
public var id: URL { url }
}
diff --git a/Packages/PeelCore/Sources/PeelCore/Packages/PackageReceipts.swift b/Packages/PeelCore/Sources/PeelCore/Packages/PackageReceipts.swift
index 9555323b..c432a81d 100644
--- a/Packages/PeelCore/Sources/PeelCore/Packages/PackageReceipts.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Packages/PackageReceipts.swift
@@ -180,8 +180,9 @@ public enum PackageReceipts {
url: url,
size: contents.flatMap { $0.couldNotBeRead ? nil : $0.size },
requiresPrivileges: requiresPrivileges,
- isLeftAlone: !removalGuard.allowsRemoval(of: url) || (requiresPrivileges && reach.isBeyond(url)),
- heldBack: HoldBack.seen(in: contents) ?? (isShared ? .sharedWithEveryone : nil)
+ refusal: removalGuard.refusal(of: url),
+ heldBack: requiresPrivileges && reach.isBeyond(url)
+ ? .beyondTheHelper : HoldBack.seen(in: contents) ?? (isShared ? .sharedWithEveryone : nil)
))
}
diff --git a/Packages/PeelCore/Sources/PeelCore/Plugins/Plugins.swift b/Packages/PeelCore/Sources/PeelCore/Plugins/Plugins.swift
index d3756bfb..dc9c537e 100644
--- a/Packages/PeelCore/Sources/PeelCore/Plugins/Plugins.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Plugins/Plugins.swift
@@ -36,9 +36,9 @@ public struct Plugin: Sendable, Hashable, Identifiable {
/// Nil when measuring ran out of time or was refused. Unknown is not the same as empty.
public let size: Int64?
public let requiresPrivileges: Bool
- /// True when Peel would refuse to move it, such as a Mail bundle in the user's own Library, where all of Mail
- /// is protected. It is listed and never offered.
- public let isLeftAlone: Bool
+ /// Why Peel would refuse to move it, such as a Mail bundle in the user's own Library, where all of Mail is
+ /// protected. Such a plug-in is listed and never offered.
+ public let refusal: GuardRefusal?
public var id: URL { url }
}
@@ -119,7 +119,7 @@ public enum Plugins {
isInstalledForAllUsers: isForAllUsers,
size: await measure(url),
requiresPrivileges: ParentAccess(url.deletingLastPathComponent()).requiresPrivileges(toRemove: url),
- isLeftAlone: !removalGuard.allowsRemoval(of: url)
+ refusal: removalGuard.refusal(of: url)
))
}
}
diff --git a/Packages/PeelCore/Sources/PeelCore/Removal/RemovalGuard.swift b/Packages/PeelCore/Sources/PeelCore/Removal/RemovalGuard.swift
index 3da78fb5..ea125933 100644
--- a/Packages/PeelCore/Sources/PeelCore/Removal/RemovalGuard.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Removal/RemovalGuard.swift
@@ -3,7 +3,7 @@ import Foundation
internal import PeelPrivileged
/// Why `RemovalGuard` refuses to move an item.
-public enum GuardRefusal: String, Sendable, Hashable {
+public enum GuardRefusal: String, Sendable, Hashable, CaseIterable {
/// The exclusions have not been read yet, or cannot be read, so nothing moves.
case exclusionsNotKnown
/// The person excluded it, or something inside it.
@@ -20,6 +20,25 @@ public enum GuardRefusal: String, Sendable, Hashable {
case holdsALibrary
/// Work an app keeps only in a cache folder is inside, such as an editor's local history.
case holdsWorkKeptInACache
+
+ /// A fixed word for the reason, which the refusal log stores, so a record still reads in a later version.
+ public var name: String {
+ switch self {
+ case .exclusionsNotKnown: "exclusions-not-known"
+ case .excluded: "excluded"
+ case .staysItself: "stays-in-place"
+ case .protectedLocation: "protected-place"
+ case .holdsProtectedData: "holds-protected-data"
+ case .holdsDocuments: "holds-documents"
+ case .holdsALibrary: "holds-a-library"
+ case .holdsWorkKeptInACache: "holds-work-kept-in-a-cache"
+ }
+ }
+
+ public init?(name: String) {
+ guard let refusal = Self.allCases.first(where: { $0.name == name }) else { return nil }
+ self = refusal
+ }
}
struct RemovalGuard: Sendable {
@@ -77,7 +96,11 @@ struct RemovalGuard: Sendable {
/// Whether `trashed` may go back to `destination`, which is judged as a removal from there would be, for the
/// kind of item `trashed` is: nothing is there yet to tell.
func allowsPuttingBack(_ trashed: URL, at destination: URL) -> Bool {
- refusal(of: destination, isALink: Self.isALink(trashed.path(percentEncoded: false))) == nil
+ refusal(ofPuttingBack: trashed, at: destination) == nil
+ }
+
+ func refusal(ofPuttingBack trashed: URL, at destination: URL) -> GuardRefusal? {
+ refusal(of: destination, isALink: Self.isALink(trashed.path(percentEncoded: false)))
}
/// True for the lower-cased spelling of a link directly in a folder command-line tools are linked into.
diff --git a/Packages/PeelCore/Sources/PeelCore/Removal/TrashService.swift b/Packages/PeelCore/Sources/PeelCore/Removal/TrashService.swift
index a9277f8c..d24fc4de 100644
--- a/Packages/PeelCore/Sources/PeelCore/Removal/TrashService.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Removal/TrashService.swift
@@ -61,7 +61,8 @@ public struct TrashedItem: Sendable, Hashable, Codable {
public struct TrashFailure: Sendable, Hashable {
public enum Reason: Sendable, Hashable {
- case protectedLocation
+ /// `RemovalGuard` refuses it, for that reason. Nil for a refusal recorded before Peel kept the reason.
+ case guarded(GuardRefusal?)
case changedSinceScan
/// Listed as an orphan, but an app installed since the scan claims it.
case claimedSinceScan
@@ -94,7 +95,7 @@ extension TrashFailure.Reason {
/// an old record still reads.
public var name: String {
switch self {
- case .protectedLocation: "protected-location"
+ case .guarded(let refusal): refusal?.name ?? "protected-location"
case .changedSinceScan: "changed-since-scan"
case .claimedSinceScan: "claimed-since-scan"
case .lastCopy: "last-copy"
@@ -119,8 +120,12 @@ extension TrashFailure.Reason {
/// The reason a refusal log stored as `name` and `detail`, or nil for a word this version doesn't know.
public init?(name: String, detail: String?) {
+ if let refusal = GuardRefusal(name: name) {
+ self = .guarded(refusal)
+ return
+ }
switch name {
- case "protected-location": self = .protectedLocation
+ case "protected-location": self = .guarded(nil)
case "changed-since-scan": self = .changedSinceScan
case "claimed-since-scan": self = .claimedSinceScan
case "last-copy": self = .lastCopy
@@ -180,7 +185,7 @@ public struct TrashService: Sendable {
forgetDomains: { await PreferenceCleanup.forgetDomains(for: $0, ownedBy: $1) },
moveThroughHelper: Self.moveThroughTheHelper,
putBackDockTiles: { await DockTiles().putBack($0) },
- moveToTrash: { try Self.moveToSystemTrash($0, isAllowed: removalGuard.allowsRemoval(of:)) },
+ moveToTrash: { try Self.moveToSystemTrash($0, refusal: removalGuard.refusal(of:)) },
ownMoves: .shared,
journal: RemovalJournal(beside: RemovalHistory.defaultURL)
)
@@ -234,13 +239,13 @@ public struct TrashService: Sendable {
self.journal = journal
}
- /// 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.
/// False while the saved exclusions are not read yet or cannot be read, when nothing moves.
public var knowsTheExclusions: Bool { removalGuard.knowsTheExclusions }
+ /// Why `url` would not move, or nil when it would. A plan can show this before anything moves, since the move
+ /// asks the same guard.
public func refusal(of url: URL) -> TrashFailure.Reason? {
- guard removalGuard.allowsRemoval(of: url) else { return .protectedLocation }
+ if let refusal = removalGuard.refusal(of: url) { return .guarded(refusal) }
return historyCanBeRead ? nil : .historyUnreadable
}
@@ -254,7 +259,7 @@ public struct TrashService: Sendable {
/// 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) }
+ let refused = urls.map { TrashFailure(url: $0, reason: refusal(of: $0) ?? .historyUnreadable) }
return TrashResult(failures: refused)
}
@@ -277,8 +282,8 @@ public struct TrashService: Sendable {
/// Moves `urls` as the current user, as part of `removal`, the move the journal groups them by, or of none.
private func trash(_ urls: [URL], ownedBy owner: String?, removal: UUID?) async -> TrashResult {
// The guard reads the disk, so it is asked once for each item.
- let allowed = urls.filter(removalGuard.allowsRemoval(of:))
- let isAllowed = Set(allowed)
+ let refusals = urls.reduce(into: [URL: GuardRefusal]()) { $0[$1] = removalGuard.refusal(of: $1) }
+ let allowed = urls.filter { refusals[$0] == nil }
let openFiles = OpenFiles()
// Read before the move, while the files are still there to say which jobs they declare.
let jobs = LaunchdCleanup.jobs(for: allowed, environment: environment)
@@ -287,8 +292,8 @@ public struct TrashService: Sendable {
var moved: [String] = []
ownMoves.began()
for url in urls {
- guard isAllowed.contains(url) else {
- result.failures.append(TrashFailure(url: url, reason: .protectedLocation))
+ if let refusal = refusals[url] {
+ result.failures.append(TrashFailure(url: url, reason: .guarded(refusal)))
continue
}
// An item inside a folder that just moved went with it: it is neither moved again nor a failure.
@@ -326,9 +331,14 @@ public struct TrashService: Sendable {
let helperURLs = urls.filter(privilegedURLs.contains)
guard !helperURLs.isEmpty else { return result }
- let permitted = helperURLs.filter(removalGuard.allowsRemoval(of:))
- let isPermitted = Set(permitted)
- result.failures += helperURLs.filter { !isPermitted.contains($0) }.map { TrashFailure(url: $0, reason: .protectedLocation) }
+ var permitted: [URL] = []
+ for url in helperURLs {
+ if let refusal = removalGuard.refusal(of: url) {
+ result.failures.append(TrashFailure(url: url, reason: .guarded(refusal)))
+ } else {
+ permitted.append(url)
+ }
+ }
// An item inside another folder of this request goes with that folder. Sent on its own, the helper would
// find it gone and report a failure.
let paths = permitted.map(PathPattern.comparablePath)
@@ -414,7 +424,7 @@ public struct TrashService: Sendable {
if fileManager.isWritableFile(atPath: ancestor) {
do {
try fileManager.createDirectory(at: parent, withIntermediateDirectories: true)
- try Self.putBack(item) { removalGuard.allowsPuttingBack(item.trashedURL, at: $0) }
+ try Self.putBack(item) { removalGuard.refusal(ofPuttingBack: item.trashedURL, at: $0) }
return nil
} catch is RefusedOnceHeld {
return .notAllowed
@@ -433,7 +443,7 @@ public struct TrashService: Sendable {
/// Moves `item` back from the Trash through a descriptor for its folder, which must already exist. The guard
/// is asked again about the destination as the kernel names it, and the move never replaces an item there.
- static func putBack(_ item: TrashedItem, isAllowed: (URL) -> Bool) throws {
+ static func putBack(_ item: TrashedItem, refusal: (URL) -> GuardRefusal?) throws {
let trashed = try OpenItem.at(item.trashedURL.path(percentEncoded: false)).get()
if let identity = item.identity, trashed.identity.map(TrashedItem.Identity.init) != identity {
throw NotTheItemThatMoved()
@@ -441,7 +451,8 @@ public struct TrashService: Sendable {
let folder = try DirectoryHandle.at(item.originalURL.deletingLastPathComponent().path(percentEncoded: false)).get()
guard let held = folder.currentPath else { throw POSIXError(.ENOENT) }
let name = item.originalURL.lastPathComponent
- guard isAllowed(URL(filePath: held, directoryHint: .isDirectory).appending(path: name)) else { throw RefusedOnceHeld() }
+ let destination = URL(filePath: held, directoryHint: .isDirectory).appending(path: name)
+ if let refused = refusal(destination) { throw RefusedOnceHeld(refusal: refused) }
try TrashMover.rename(trashed, to: name, in: folder).get()
}
@@ -476,7 +487,7 @@ public struct TrashService: Sendable {
/// The failure reason for an error a move threw. macOS does not say which permission is missing, so any
/// refusal is `.notPermitted`, and the caller decides what it means.
static func reason(for error: any Error) -> TrashFailure.Reason {
- if error is RefusedOnceHeld { return .protectedLocation }
+ if let refused = error as? RefusedOnceHeld { return .guarded(refused.refusal) }
if error is MovedWithoutATrace { return .movedWithoutATrace }
if let moved = error as? SomethingElseMoved { return .somethingElseMoved(named: moved.trashedURL.lastPathComponent) }
let error = error as NSError
@@ -490,7 +501,9 @@ public struct TrashService: Sendable {
struct MovedWithoutATrace: Error {}
/// The guard refused the item once its folder was held open and named by the kernel.
- struct RefusedOnceHeld: Error {}
+ struct RefusedOnceHeld: Error {
+ let refusal: GuardRefusal
+ }
/// What sits where an item went in the Trash is another item: the Trash was emptied, and something of the same
/// name landed there since.
@@ -509,12 +522,12 @@ public struct TrashService: Sendable {
_ url: URL,
trash: (URL) throws -> URL = Self.trashMacOSNames,
byName: (URL) throws -> URL = Self.moveByName,
- isAllowed: (URL) -> Bool
+ refusal: (URL) -> GuardRefusal?
) throws -> URL {
let item = try OpenItem.at(url.path(percentEncoded: false)).get()
guard let folder = item.parent.currentPath else { throw POSIXError(.ENOENT) }
let held = URL(filePath: folder, directoryHint: .isDirectory).appending(path: item.name)
- guard isAllowed(held) else { throw RefusedOnceHeld() }
+ if let refused = refusal(held) { throw RefusedOnceHeld(refusal: refused) }
guard let named = try? trash(held) else {
// A volume where nothing was ever trashed has no Trash yet, and only `FileManager.trashItem` creates
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/AttackDuplicateTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/AttackDuplicateTests.swift
index 42421ab5..288db0b2 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/AttackDuplicateTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/AttackDuplicateTests.swift
@@ -122,7 +122,7 @@ struct AttackDuplicateTests {
#expect(found.groups.isEmpty, "iCloud Drive is offered for duplicate cleaning")
guard !found.groups.isEmpty else { return }
let result = await DuplicateRemoval.trash(found.suggestedSelection, from: found, using: try service(directory))
- #expect(result.failures.map(\.reason) == [.protectedLocation], "and then every removal is refused")
+ #expect(result.failures.map(\.reason) == [.guarded(.protectedLocation)], "and then every removal is refused")
}
/// A media library whose app is not installed is a plain folder to the enumerator. A file inside one must not
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/AttackPathProducerTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/AttackPathProducerTests.swift
index c6c0e24d..d91d6134 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/AttackPathProducerTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/AttackPathProducerTests.swift
@@ -98,7 +98,8 @@ struct AttackPathProducerTests {
return destination
}
let result = await service.trash([url])
- #expect(result.failures.map(\.reason) == [.protectedLocation], "the guard let a symlinked path through")
+ let reasons = result.failures.map(\.reason)
+ #expect(reasons == [.guarded(.protectedLocation)], "the guard let a symlinked path through")
#expect(
FileManager.default.fileExists(atPath: real.path(percentEncoded: false)),
"ATTACK SUCCEEDED: an iCloud Drive folder was removed through a symbolic link"
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/AttackRemovalGuardTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/AttackRemovalGuardTests.swift
index 38de8a68..729240b3 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/AttackRemovalGuardTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/AttackRemovalGuardTests.swift
@@ -171,7 +171,8 @@ struct AttackRemovalGuardTests {
let disguised = home.appending(path: "Library/mobile documents/com~apple~CloudDocs/Thesis.pages")
let result = await service.trash([disguised])
- #expect(result.failures.map(\.reason) == [.protectedLocation], "ATTACK SUCCEEDED: TrashService moved an iCloud Drive file")
+ let reasons = result.failures.map(\.reason)
+ #expect(reasons == [.guarded(.protectedLocation)], "ATTACK SUCCEEDED: TrashService moved an iCloud Drive file")
#expect(
FileManager.default.fileExists(atPath: real.path(percentEncoded: false)),
"ATTACK SUCCEEDED: the real iCloud file is gone, which syncs the deletion to every device"
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/BackgroundItemActionsTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/BackgroundItemActionsTests.swift
index 8995ebad..2de1f9b2 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/BackgroundItemActionsTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/BackgroundItemActionsTests.swift
@@ -60,7 +60,7 @@ struct BackgroundItemActionsTests {
func service(refusing: Bool) -> TrashService {
TrashService(environment: SearchEnvironment(homeDirectory: URL(filePath: "/Users/x"), rootDirectory: URL(filePath: "/"))) { url in
steps.withLock { $0.append("move") }
- if refusing { throw TrashService.RefusedOnceHeld() }
+ if refusing { throw TrashService.RefusedOnceHeld(refusal: .protectedLocation) }
return url
}
}
@@ -79,7 +79,7 @@ struct BackgroundItemActionsTests {
item(.userLibrary, state: .running(pid: 7), plist: plist), isHelperEnabled: false, trash: service(refusing: true), stop: stop
)
#expect(refused.trashed.isEmpty)
- #expect(refused.failures.map(\.reason) == [.protectedLocation])
+ #expect(refused.failures.map(\.reason) == [.guarded(.protectedLocation)])
#expect(steps.withLock { $0 } == ["move"])
// A job launchd does not hold has nothing to stop.
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/CarriedSelectionTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/CarriedSelectionTests.swift
index 8c5d38e6..db034dba 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/CarriedSelectionTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/CarriedSelectionTests.swift
@@ -105,7 +105,7 @@ struct CarriedSelectionTests {
var result = TrashResult()
for url in part.sizes.keys {
if url.lastPathComponent == "ModuleCache" {
- result.failures.append(TrashFailure(url: url, reason: .protectedLocation))
+ result.failures.append(TrashFailure(url: url, reason: .guarded(.protectedLocation)))
} else {
result.trashed.append(TrashedItem(originalURL: url, trashedURL: url, date: .now))
}
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/CleanupTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/CleanupTests.swift
index 231ca212..b14a5738 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/CleanupTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/CleanupTests.swift
@@ -37,7 +37,7 @@ struct CleanupTests {
#expect(plan.moving.map(\.url) == [cache])
#expect(plan.staying.map(\.url) == [documents])
- #expect(plan.staying.first?.refusal == .protectedLocation)
+ #expect(plan.staying.first?.refusal == .guarded(.staysItself))
#expect(plan.total.known == 20)
}
@@ -169,7 +169,7 @@ struct CleanupTests {
try await plan.run(question: "?", dryRun: false, yes: true, using: try service(in: directory), recordingIn: log, refusals: refusals)
#expect(await RemovalLog(url: log.url).load().records?.isEmpty == true)
- #expect(await RefusalLog(url: refusals.url).load().map(\.reason) == ["protected-location"])
+ #expect(await RefusalLog(url: refusals.url).load().map(\.reason) == ["stays-in-place"])
#expect(FileManager.default.fileExists(atPath: documents.path(percentEncoded: false)))
}
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/CommandLineTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/CommandLineTests.swift
index 1603f253..cd335422 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/CommandLineTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/CommandLineTests.swift
@@ -294,7 +294,7 @@ struct CommandLineTests {
let plan = UninstallPlan(app: app, items: [
UninstallPlan.Item(url: app, size: 4_096, refusal: nil),
UninstallPlan.Item(url: support, size: nil, refusal: nil),
- UninstallPlan.Item(url: caches, size: 10, refusal: .protectedLocation),
+ UninstallPlan.Item(url: caches, size: 10, refusal: .guarded(.excluded)),
], needsAdministrator: 1, needsReview: 2)
let result = TrashResult(trashed: [], failures: [TrashFailure(url: support, reason: .failed("disk full"))])
let editor = InstalledApp(url: app, bundleIdentifier: "com.example.editor", name: "Editor")
@@ -303,7 +303,7 @@ struct CommandLineTests {
let report = try #require(JSONSerialization.jsonObject(with: Data(json.utf8)) as? [String: Any])
let items = try #require(report["items"] as? [[String: Any]])
- #expect(items.map { $0["stays"] as? String } == [nil, nil, "protected-location"])
+ #expect(items.map { $0["stays"] as? String } == [nil, nil, "excluded"])
#expect(items[0]["stays"] is NSNull)
#expect(items[1]["size"] is NSNull)
let failed = try #require(report["failed"] as? [[String: Any]])
@@ -491,7 +491,7 @@ struct CommandLineTests {
let plan = UninstallPlan.make(
uninstallation(app: app, leftovers: [leftover(cache)]),
keepLeftovers: false,
- refusal: { $0 == cache ? .protectedLocation : nil }
+ refusal: { $0 == cache ? .guarded(.protectedLocation) : nil }
)
#expect(plan.moving.map(\.url) == [app.url])
@@ -502,9 +502,9 @@ struct CommandLineTests {
let refused = UninstallPlan.make(
uninstallation(app: app, leftovers: [leftover(cache)]),
keepLeftovers: false,
- refusal: { $0 == app.url ? .protectedLocation : nil }
+ refusal: { $0 == app.url ? .guarded(.protectedLocation) : nil }
)
- #expect(refused.appStays == .protectedLocation)
+ #expect(refused.appStays == .guarded(.protectedLocation))
}
/// What stays is counted where the user can see it, and a size nobody knows is never added up as zero.
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/ExclusionsTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/ExclusionsTests.swift
index 48ea25ce..e8b4a119 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/ExclusionsTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/ExclusionsTests.swift
@@ -107,7 +107,7 @@ struct ExclusionsTests {
let result = await service.trash([folder])
#expect(result.trashed.isEmpty)
- #expect(result.failures.map(\.reason) == [.protectedLocation])
+ #expect(result.failures.map(\.reason) == [.guarded(.excluded)])
#expect(FileManager.default.fileExists(atPath: kept.path(percentEncoded: false)))
}
@@ -234,7 +234,7 @@ struct ExclusionsTests {
let result = await service.trash([item])
#expect(result.trashed.isEmpty)
- #expect(result.failures.map(\.reason) == [.protectedLocation])
+ #expect(result.failures.map(\.reason) == [.guarded(.exclusionsNotKnown)])
}
/// A list Peel cannot reach is not known to be empty: a folder on the way that cannot be searched, or a link
@@ -262,7 +262,7 @@ struct ExclusionsTests {
let result = await service.trash([item])
#expect(result.trashed.isEmpty)
- #expect(result.failures.map(\.reason) == [.protectedLocation])
+ #expect(result.failures.map(\.reason) == [.guarded(.exclusionsNotKnown)])
#expect(!Exclusions.notYetRead.isKnown && !Exclusions.notYetRead.isUnreadable)
#expect(Exclusions.none.isKnown && !Exclusions.unreadable.isKnown)
}
@@ -295,7 +295,7 @@ struct ExclusionsTests {
let result = await service.trash([kept, removable])
#expect(result.trashed.map(\.originalURL) == [removable])
- #expect(result.failures.map(\.reason) == [.protectedLocation])
+ #expect(result.failures.map(\.reason) == [.guarded(.excluded)])
#expect(FileManager.default.fileExists(atPath: kept.path(percentEncoded: false)))
}
}
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/HistoryCommandTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/HistoryCommandTests.swift
index 6ec1e584..6661ca62 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/HistoryCommandTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/HistoryCommandTests.swift
@@ -81,7 +81,10 @@ struct HistoryCommandTests {
@Test func writesEveryColumnOfARefusal() {
let when = Date(timeIntervalSince1970: 1_790_000_000)
let records = [
- RefusalRecord(failure: TrashFailure(url: URL(filePath: "/Users/me/Library/Mail"), reason: .protectedLocation), date: when, source: "Editor", tool: "applications"),
+ RefusalRecord(
+ failure: TrashFailure(url: URL(filePath: "/Users/me/Library/Mail"), reason: .guarded(nil)),
+ date: when, source: "Editor", tool: "applications"
+ ),
RefusalRecord(failure: TrashFailure(url: URL(filePath: "/Users/me/x.bin"), reason: .failed("no such file")), date: when, source: "Editor", tool: "applications"),
]
let rows = HistoryCommand.rows(for: records)
@@ -250,7 +253,7 @@ struct HistoryCommandTests {
await logs.refusals.add([old], source: "Old", tool: "duplicates", date: .now.addingTimeInterval(-60))
await logs.refusals.add(
[
- TrashFailure(url: URL(filePath: "/Users/me/My Files/a.bin"), reason: .protectedLocation),
+ TrashFailure(url: URL(filePath: "/Users/me/My Files/a.bin"), reason: .guarded(.excluded)),
TrashFailure(url: URL(filePath: "/Users/me/b.bin"), reason: .failed("disk full")),
],
source: "Editor", tool: "applications"
@@ -267,8 +270,8 @@ struct HistoryCommandTests {
#expect(removal["batch"] is String)
let items = try #require(removal["items"] as? [[String: Any]])
#expect(items.map { $0["path"] as? String } == ["/Users/me/My Files/a.bin", "/Users/me/b.bin"])
- #expect(items.map { $0["reason"] as? String } == ["protected-location", "failed"])
- #expect(items.map { $0["why"] as? String } == ["protected location", "disk full"])
+ #expect(items.map { $0["reason"] as? String } == ["excluded", "failed"])
+ #expect(items.map { $0["why"] as? String } == ["excluded", "disk full"])
#expect(items[0]["detail"] is NSNull)
}
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/MovableTotalTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/MovableTotalTests.swift
index 2b88a74e..dbcb0cd3 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/MovableTotalTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/MovableTotalTests.swift
@@ -24,7 +24,7 @@ struct MovableTotalTests {
var tool = PackageReceipt.Item(
url: URL(filePath: "/usr/local/bin/org.example.tool"), size: 500, requiresPrivileges: true
)
- tool.isLeftAlone = true
+ tool.refusal = .protectedLocation
let app = PackageReceipt.Item(
url: URL(filePath: "/Applications/Example.app"), size: 20, requiresPrivileges: false
)
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/PackageReceiptsTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/PackageReceiptsTests.swift
index ee08e719..1c37f5cf 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/PackageReceiptsTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/PackageReceiptsTests.swift
@@ -332,6 +332,7 @@ struct PackageReceiptsTests {
#expect(receipt.items.first { $0.url == app }?.isLeftAlone == false)
#expect(receipt.items.first { $0.url == rules }?.isLeftAlone == true)
+ #expect(receipt.items.first { $0.url == rules }?.refusal == .protectedLocation)
}
/// An item that needs an administrator is left alone when the helper would refuse it. The helper refuses
@@ -378,6 +379,7 @@ struct PackageReceiptsTests {
#expect(try item(served).isLeftAlone == false)
#expect(try item(vendor).isLeftAlone == true)
#expect(try item(tools).isLeftAlone == true)
+ #expect(try [item(vendor), item(tools)].map(\.heldBack) == [.beyondTheHelper, .beyondTheHelper])
func tool(_ name: String) throws -> PackageReceipt.Item {
try #require(receipt.items.first { $0.url.deletingLastPathComponent().lastPathComponent == "bin" && $0.url.lastPathComponent == name })
}
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/PluginsTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/PluginsTests.swift
index 5158feed..a7563b6f 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/PluginsTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/PluginsTests.swift
@@ -92,8 +92,8 @@ struct PluginsTests {
let plugins = await Plugins.scan(environment: environment)
- #expect(try #require(plugins.first { $0.category == .mailBundles }).isLeftAlone, "a Mail bundle the guard refuses was offered")
- #expect(try #require(plugins.first { $0.category == .vst3 }).isLeftAlone == false)
+ #expect(try #require(plugins.first { $0.category == .mailBundles }).refusal == .protectedLocation)
+ #expect(try #require(plugins.first { $0.category == .vst3 }).refusal == nil)
}
/// Vendors keep their plug-ins in a folder of their own, and that folder's name can seem to have an
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/RefusalLogTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/RefusalLogTests.swift
index 028c5838..45d3cf61 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/RefusalLogTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/RefusalLogTests.swift
@@ -13,7 +13,10 @@ struct RefusalLogTests {
let log = RefusalLog(url: directory.url.appending(path: "Peel/refusals.json"))
await log.add(
- [failure("/Users/me/Library/Mail", .protectedLocation), failure("/Users/me/x.bin", .failed("no such file"))],
+ [
+ failure("/Users/me/Library/Mail", .guarded(.protectedLocation)),
+ failure("/Users/me/x.bin", .failed("no such file")),
+ ],
source: "Editor",
tool: "applications"
)
@@ -21,9 +24,9 @@ struct RefusalLogTests {
let records = await RefusalLog(url: log.url).load()
#expect(records.count == 2)
#expect(records.allSatisfy { $0.source == "Editor" && $0.tool == "applications" })
- #expect(Set(records.map(\.reason)) == ["protected-location", "failed"])
+ #expect(Set(records.map(\.reason)) == ["protected-place", "failed"])
#expect(records.first { $0.reason == "failed" }?.detail == "no such file")
- #expect(records.first { $0.reason == "protected-location" }?.detail == nil)
+ #expect(records.first { $0.reason == "protected-place" }?.detail == nil)
}
/// History records nothing when nothing moved, but the refusals are still written: a removal where
@@ -32,12 +35,12 @@ struct RefusalLogTests {
let directory = try TemporaryDirectory()
let log = RemovalLog(url: directory.url.appending(path: "Peel/removals.json"))
let refusals = RefusalLog(url: directory.url.appending(path: "Peel/refusals.json"))
- let result = TrashResult(failures: [failure("/Users/me/Library/Mail", .protectedLocation)])
+ let result = TrashResult(failures: [failure("/Users/me/Library/Mail", .guarded(.protectedLocation))])
#expect(await Removals.record(result, from: "Editor", sizes: [:], tool: "applications", in: log, refusals: refusals))
#expect(await RemovalLog(url: log.url).load().records?.isEmpty == true)
- #expect(await RefusalLog(url: refusals.url).load().map(\.reason) == ["protected-location"])
+ #expect(await RefusalLog(url: refusals.url).load().map(\.reason) == ["protected-place"])
}
/// History is the way back for what just moved, so it is written before the refusals: while the refusal log
@@ -53,7 +56,9 @@ struct RefusalLogTests {
trashedURL: URL(filePath: "/Users/me/.Trash/com.example.app"),
date: .now
)
- let result = TrashResult(trashed: [moved], failures: [failure("/Users/me/Library/Mail", .protectedLocation)])
+ let result = TrashResult(
+ trashed: [moved], failures: [failure("/Users/me/Library/Mail", .guarded(.protectedLocation))]
+ )
// Holds the refusal log's lock, as another process writing it would.
let lockFile = folder.appending(path: "refusals.json.lock").path(percentEncoded: false)
let lock = open(lockFile, O_CREAT | O_RDWR | O_CLOEXEC, 0o600)
@@ -149,10 +154,10 @@ struct RefusalLogTests {
}
private static let everyReason: [TrashFailure.Reason] = [
- .protectedLocation, .changedSinceScan, .claimedSinceScan, .lastCopy, .notPermitted, .needsHelper,
+ .guarded(nil), .changedSinceScan, .claimedSinceScan, .lastCopy, .notPermitted, .needsHelper,
.movedWithoutATrace, .somethingElseMoved(named: "x 2"), .historyUnreadable,
.heldOpen(by: ["Figma Agent", "java"]), .failed("x"),
- ]
+ ] + GuardRefusal.allCases.map { .guarded($0) }
/// A record stores its reason as a word, not a sentence, so a later version of Peel can still read it.
@Test func everyReasonHasAWordOfItsOwn() {
@@ -172,6 +177,11 @@ struct RefusalLogTests {
#expect(TrashFailure.Reason(name: "a-word-from-later", detail: nil) == nil)
}
+ /// A refusal recorded before Peel kept the guard's reason reads as one whose reason is not known.
+ @Test func anOldRefusalOfTheGuardStillReads() {
+ #expect(TrashFailure.Reason(name: "protected-location", detail: nil) == .guarded(nil))
+ }
+
/// What one removal refused shares a batch and its source, so History shows it as one entry, in the words of
/// the source Peel named.
@Test func oneRemovalsRefusalsShareABatch() async throws {
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/RemovalJournalTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/RemovalJournalTests.swift
index 5d5d5891..1076411b 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/RemovalJournalTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/RemovalJournalTests.swift
@@ -135,12 +135,12 @@ struct RemovalJournalTests {
}
#expect(service.refusal(of: item) == .historyUnreadable)
- #expect(service.refusal(of: keychains) == .protectedLocation)
+ #expect(service.refusal(of: keychains) == .guarded(.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(result.failures.map(\.reason) == [.historyUnreadable, .guarded(.protectedLocation)])
#expect(throughTheHelper.failures.map(\.reason) == [.historyUnreadable])
#expect(await service.trashOwnFiles([item]).trashed.count == 1, "Peel's own files waited for History")
}
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/TrashServiceTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/TrashServiceTests.swift
index 2fe91e81..3e8466e9 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/TrashServiceTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/TrashServiceTests.swift
@@ -189,7 +189,7 @@ struct TrashServiceTests {
let result = await service.trash([kept, going])
- #expect(result.failures == [TrashFailure(url: kept, reason: .protectedLocation)])
+ #expect(result.failures == [TrashFailure(url: kept, reason: .guarded(.excluded))])
#expect(await stopped.labels == ["com.example.going"])
#expect(kept.isThere)
}
@@ -341,7 +341,7 @@ struct TrashServiceTests {
let item = TrashedItem(originalURL: original, trashedURL: first, date: .now, identity: identity)
#expect(throws: TrashService.NotTheItemThatMoved.self) {
- try TrashService.putBack(item) { _ in true }
+ try TrashService.putBack(item) { _ in nil }
}
#expect(!FileManager.default.fileExists(atPath: original.path(percentEncoded: false)))
}
@@ -465,7 +465,7 @@ struct TrashServiceTests {
},
byName: byName
) { pinned in
- let answer = removalGuard.allowsRemoval(of: pinned)
+ let answer = removalGuard.refusal(of: pinned)
afterTheGuard()
return answer
}
@@ -505,7 +505,7 @@ struct TrashServiceTests {
let removalGuard = RemovalGuard(environment: SearchEnvironment(homeDirectory: home, rootDirectory: directory.url.appending(path: "root")))
try TrashService.putBack(record) { held in
- let answer = removalGuard.allowsRemoval(of: held)
+ let answer = removalGuard.refusal(of: held)
try? FileManager.default.moveItem(at: caches.appending(path: "Vendor"), to: caches.appending(path: "Vendor.real"))
try? FileManager.default.createSymbolicLink(atPath: caches.appending(path: "Vendor").path(percentEncoded: false), withDestinationPath: cloud.path(percentEncoded: false))
return answer
@@ -638,10 +638,37 @@ struct TrashServiceTests {
let result = try await service(in: directory).trash(protected)
#expect(result.trashed.isEmpty)
- #expect(result.failures.map(\.reason) == Array(repeating: TrashFailure.Reason.protectedLocation, count: protected.count))
+ let staying = TrashFailure.Reason.guarded(.staysItself), macOS = TrashFailure.Reason.guarded(.protectedLocation)
+ #expect(result.failures.map(\.reason) == [staying, staying, staying, staying, macOS, macOS])
#expect(FileManager.default.fileExists(atPath: home.appending(path: "Library/Caches").path(percentEncoded: false)))
}
+ /// A refusal says which of the guard's rules kept the item, so a plan, History and the refusal log can say why.
+ @Test func saysWhichRuleKeepsEachItem() async throws {
+ let directory = try TemporaryDirectory()
+ let excluded = try directory.file("home/Library/Caches/org.example.Kept/cache.db").deletingLastPathComponent()
+ let work = try directory.file("home/Library/Caches/org.example.Editor/LocalHistory/changes.storageData")
+ .deletingLastPathComponent().deletingLastPathComponent()
+ let library = try directory.file("home/Pictures/Trips/Summer.photoslibrary/database/Photos.sqlite")
+ .deletingLastPathComponent().deletingLastPathComponent().deletingLastPathComponent()
+ let keychains = try directory.directory("home/Library/Keychains")
+ let documents = try directory.directory("home/Documents")
+ let service = TrashService(
+ environment: SearchEnvironment(
+ homeDirectory: directory.url.appending(path: "home"),
+ rootDirectory: directory.url.appending(path: "root")
+ ),
+ exclusions: Exclusions(paths: [excluded])
+ ) { $0 }
+
+ let result = await service.trash([excluded, work, library, keychains, documents])
+
+ #expect(result.failures.map(\.reason) == [
+ .guarded(.excluded), .guarded(.holdsWorkKeptInACache), .guarded(.holdsALibrary),
+ .guarded(.protectedLocation), .guarded(.staysItself),
+ ])
+ }
+
@Test func leavesAFolderAnotherProcessHoldsAFileOpenIn() async throws {
let directory = try TemporaryDirectory()
let service = try service(in: directory)
diff --git a/Peel/Views/Packages/PackageDetailView.swift b/Peel/Views/Packages/PackageDetailView.swift
index 14ae0c9c..e8095464 100644
--- a/Peel/Views/Packages/PackageDetailView.swift
+++ b/Peel/Views/Packages/PackageDetailView.swift
@@ -29,8 +29,8 @@ struct PackageDetailView: View {
RemovalRow(
url: item.url,
icon: item.url.pathExtension == "app" ? .file(item.url) : .symbol("doc"),
- detail: item.isLeftAlone ? "Left alone: Peel won’t move this, because of where it sits or what is inside it." : nil,
- warning: item.isLeftAlone ? nil : item.heldBack.map { String(localized: $0.explanation) },
+ detail: item.refusal?.explanation,
+ warning: item.refusal == nil ? item.heldBack.map { String(localized: $0.explanation) } : nil,
size: item.size ?? 0,
isMeasured: item.size != nil,
isLocked: item.requiresPrivileges && !helper.canAct,
diff --git a/Peel/Views/Plugins/PluginDetailView.swift b/Peel/Views/Plugins/PluginDetailView.swift
index 7a760255..68e83eb1 100644
--- a/Peel/Views/Plugins/PluginDetailView.swift
+++ b/Peel/Views/Plugins/PluginDetailView.swift
@@ -71,8 +71,8 @@ struct PluginDetailView: View {
Section {
RemovalsHeldBanner()
- if plugin.isLeftAlone {
- Text("Peel won’t move this: it is protected, or your exclusions in Settings keep it where it is.")
+ if let refusal = plugin.refusal {
+ Text(refusal.explanation)
.font(.callout)
.foregroundStyle(.secondary)
}
@@ -85,7 +85,10 @@ struct PluginDetailView: View {
isConfirmingRemoval = true
}
.buttonStyle(.borderedProminent)
- .disabled(isLocked || plugin.isLeftAlone || plugins.isRemoving || plugins.isScanning || !exclusions.exclusions.isKnown || history.isUnreadable)
+ .disabled(
+ isLocked || plugin.refusal != nil || plugins.isRemoving || plugins.isScanning
+ || !exclusions.exclusions.isKnown || history.isUnreadable
+ )
}
}
}
@@ -109,6 +112,6 @@ struct PluginDetailView: View {
}
private var isLocked: Bool {
- plugin.requiresPrivileges && !plugin.isLeftAlone && !helper.canAct
+ plugin.requiresPrivileges && plugin.refusal == nil && !helper.canAct
}
}
diff --git a/Peel/Views/Presentation.swift b/Peel/Views/Presentation.swift
index 86ad5c63..a91cdfc0 100644
--- a/Peel/Views/Presentation.swift
+++ b/Peel/Views/Presentation.swift
@@ -107,11 +107,28 @@ extension SearchLocation.Kind {
}
}
+extension GuardRefusal {
+ /// Why Peel never moves the item, in words for the person who asked to move it.
+ var explanation: LocalizedStringResource {
+ switch self {
+ case .exclusionsNotKnown: "Peel won’t move this until it can read your exclusions."
+ case .excluded: "Peel won’t move this: your exclusions in Settings keep it where it is."
+ case .staysItself: "Peel won’t move this folder itself, since macOS expects to find it. What is inside it can go."
+ case .protectedLocation: "Peel won’t move this: it is part of macOS, or inside something Peel protects."
+ case .holdsProtectedData: "Peel won’t move this: something Peel protects is inside, such as a keychain or a wallet."
+ case .holdsDocuments: "Peel won’t move this: an app’s documents are inside."
+ case .holdsALibrary: "Peel won’t move this: a photo, music, or video library is inside."
+ case .holdsWorkKeptInACache: "Peel won’t move this: an app keeps work inside that exists nowhere else, such as an editor’s local history."
+ }
+ }
+}
+
extension TrashFailure.Reason {
/// What went wrong with one item of a removal, in words for the user who asked to move it.
var explanation: String {
switch self {
- case .protectedLocation: String(localized: "Peel won’t move this: it is protected, or your exclusions in Settings keep it where it is.")
+ case .guarded(let refusal?): String(localized: refusal.explanation)
+ case .guarded(nil): String(localized: "Peel won’t move this: it is protected, or your exclusions in Settings keep it where it is.")
case .changedSinceScan: String(localized: "It changed after Peel looked at it. Scan again to review it.")
case .claimedSinceScan: String(localized: "Peel couldn’t confirm it is still nobody’s: an installed app may claim it now. Scan again to review it.")
case .lastCopy: String(localized: "The copy Peel was keeping has changed or moved since the scan, so this one may be the last.")