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
Say why a copy of an app's settings couldn't be made or read
Țugui Dragoș79489d72d99f
diff --git a/Localization/Peel/Localizable.xcstrings b/Localization/Peel/Localizable.xcstringsindex d6b8e8e2..30b13258 100644--- a/Localization/Peel/Localizable.xcstrings+++ b/Localization/Peel/Localizable.xcstrings@@ -140060,6 +140060,112 @@}}},+ "Peel couldn’t make a folder for the copy." : {+ "localizations" : {+ "cs" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel nemohl vytvořit složku pro kopii."+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel konnte keinen Ordner für die Kopie erstellen."+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel no ha podido crear una carpeta para la copia."+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel n’a pas pu créer de dossier pour la copie."+ }+ },+ "it" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel non è riuscito a creare una cartella per la copia."+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peelはコピー用のフォルダを作成できませんでした。"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel이 복사본을 넣을 폴더를 만들 수 없었습니다."+ }+ },+ "nl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel kon geen map voor de kopie maken."+ }+ },+ "pl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel nie mógł utworzyć folderu na kopię."+ }+ },+ "pt" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "O Peel não conseguiu criar uma pasta para a cópia."+ }+ },+ "ro" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel nu a putut crea un dosar pentru copie."+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel не удалось создать папку для копии."+ }+ },+ "sv" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel kunde inte skapa en mapp för kopian."+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel kopya için bir klasör oluşturamadı."+ }+ },+ "uk" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel не вдалося створити папку для копії."+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel未能为副本创建文件夹。"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel無法為副本建立檔案夾。"+ }+ }+ }+ },"Peel couldn’t make sure Homebrew keeps the formulae your exclusions cover, so it ran nothing. A brew.env file that sets HOMEBREW_NO_CLEANUP_FORMULAE replaces the list Peel gives it." : {"localizations" : {"cs" : {@@ -140272,6 +140378,112 @@}}},+ "Peel couldn’t open the copy’s folder." : {+ "localizations" : {+ "cs" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel nemohl otevřít složku kopie."+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel konnte den Ordner der Kopie nicht öffnen."+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel no ha podido abrir la carpeta de la copia."+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel n’a pas pu ouvrir le dossier de la copie."+ }+ },+ "it" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel non è riuscito ad aprire la cartella della copia."+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peelはコピーのフォルダを開けませんでした。"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel이 복사본의 폴더를 열 수 없었습니다."+ }+ },+ "nl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel kon de map van de kopie niet openen."+ }+ },+ "pl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel nie mógł otworzyć folderu kopii."+ }+ },+ "pt" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "O Peel não conseguiu abrir a pasta da cópia."+ }+ },+ "ro" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel nu a putut deschide dosarul copiei."+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel не удалось открыть папку копии."+ }+ },+ "sv" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel kunde inte öppna kopians mapp."+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel kopyanın klasörünü açamadı."+ }+ },+ "uk" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel не вдалося відкрити папку копії."+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel未能打开副本所在的文件夹。"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel無法打開副本的檔案夾。"+ }+ }+ }+ },"Peel couldn’t open this app" : {"localizations" : {"cs" : {@@ -203835,6 +204047,112 @@}}},+ "The app has no identifier Peel can name a copy after." : {+ "localizations" : {+ "cs" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Aplikace nemá identifikátor, podle kterého by Peel mohl kopii pojmenovat."+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Die App hat keine ID, nach der Peel eine Kopie benennen kann."+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "La app no tiene ningún identificador con el que Peel pueda dar nombre a una copia."+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "L’app n’a aucun identifiant que Peel puisse utiliser pour nommer une copie."+ }+ },+ "it" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "L’app non ha un identificatore con cui Peel possa dare un nome a una copia."+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "このアプリには、Peelがコピーの名前に使える識別子がありません。"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "이 앱에는 Peel이 복사본의 이름으로 쓸 수 있는 식별자가 없습니다."+ }+ },+ "nl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "De app heeft geen ID waarnaar Peel een kopie kan vernoemen."+ }+ },+ "pl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Aplikacja nie ma identyfikatora, według którego Peel mógłby nazwać kopię."+ }+ },+ "pt" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "O app não tem um identificador que o Peel possa usar para nomear uma cópia."+ }+ },+ "ro" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Aplicația nu are un identificator după care Peel să poată denumi o copie."+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "У приложения нет идентификатора, по которому Peel мог бы назвать копию."+ }+ },+ "sv" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Appen har ingen identifierare som Peel kan namnge en kopia efter."+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Uygulamanın, Peel’in bir kopyaya ad olarak verebileceği bir tanıtıcısı yok."+ }+ },+ "uk" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "У програми немає ідентифікатора, за яким Peel могла б назвати копію."+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "该App没有Peel可用来为副本命名的标识符。"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "此App沒有Peel可用來為副本命名的識別碼。"+ }+ }+ }+ },"The app itself. Everything under it is what Peel found for this app elsewhere on this Mac." : {"localizations" : {"cs" : {@@ -205320,6 +205638,430 @@}}},+ "The copy holds no settings file." : {+ "localizations" : {+ "cs" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Kopie neobsahuje žádný soubor nastavení."+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Die Kopie enthält keine Einstellungsdatei."+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "La copia no contiene ningún archivo de ajustes."+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "La copie ne contient aucun fichier de réglages."+ }+ },+ "it" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "La copia non contiene alcun file delle impostazioni."+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "このコピーには設定ファイルが含まれていません。"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "복사본에 설정 파일이 없습니다."+ }+ },+ "nl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "De kopie bevat geen instellingenbestand."+ }+ },+ "pl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Kopia nie zawiera pliku ustawień."+ }+ },+ "pt" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "A cópia não contém nenhum arquivo de ajustes."+ }+ },+ "ro" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Copia nu conține niciun fișier de configurare."+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "В копии нет файла настроек."+ }+ },+ "sv" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Kopian innehåller ingen inställningsfil."+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Kopyada hiçbir ayar dosyası yok."+ }+ },+ "uk" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Копія не містить файлу налаштувань."+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "该副本中没有设置文件。"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "此副本中沒有設定檔。"+ }+ }+ }+ },+ "The copy’s settings files aren’t in a form Peel can read." : {+ "localizations" : {+ "cs" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Soubory nastavení v kopii nejsou ve formátu, který by Peel dokázal přečíst."+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Die Einstellungsdateien der Kopie liegen nicht in einer Form vor, die Peel lesen kann."+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Los archivos de ajustes de la copia no están en un formato que Peel pueda leer."+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Les fichiers de réglages de la copie ne sont pas dans un format que Peel peut lire."+ }+ },+ "it" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "I file delle impostazioni della copia non sono in un formato che Peel possa leggere."+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "このコピーの設定ファイルは、Peelが読み取れる形式ではありません。"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "복사본의 설정 파일이 Peel이 읽을 수 있는 형식이 아닙니다."+ }+ },+ "nl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "De instellingenbestanden van de kopie hebben geen indeling die Peel kan lezen."+ }+ },+ "pl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Pliki ustawień w kopii nie są w formie, którą Peel może odczytać."+ }+ },+ "pt" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Os arquivos de ajustes da cópia não estão em um formato que o Peel consiga ler."+ }+ },+ "ro" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Fișierele de configurare ale copiei nu sunt într‑un format pe care Peel să îl poată citi."+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Файлы настроек в копии имеют формат, который Peel не может прочитать."+ }+ },+ "sv" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Kopians inställningsfiler är inte i ett format som Peel kan läsa."+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Kopyanın ayar dosyaları Peel’in okuyabileceği bir biçimde değil."+ }+ },+ "uk" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Файли налаштувань у копії мають формат, якого Peel не може прочитати."+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "该副本的设置文件不是Peel可以读取的格式。"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "此副本的設定檔不是Peel能讀取的格式。"+ }+ }+ }+ },+ "The defaults command couldn’t copy %@." : {+ "localizations" : {+ "cs" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Příkaz defaults nemohl zkopírovat %@."+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Der Befehl „defaults“ konnte %@ nicht kopieren."+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "El comando defaults no ha podido copiar %@."+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "La commande defaults n’a pas pu copier %@."+ }+ },+ "it" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Il comando defaults non è riuscito a copiare %@."+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "defaultsコマンドが“%@”をコピーできませんでした。"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "defaults 명령이 %@을(를) 복사할 수 없었습니다."+ }+ },+ "nl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Het commando defaults kon %@ niet kopiëren."+ }+ },+ "pl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Polecenie defaults nie mogło skopiować domeny %@."+ }+ },+ "pt" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "O comando defaults não conseguiu copiar %@."+ }+ },+ "ro" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Comanda defaults nu a putut copia %@."+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Команде defaults не удалось скопировать настройки %@."+ }+ },+ "sv" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Kommandot defaults kunde inte kopiera %@."+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "defaults komutu %@ ayarlarını kopyalayamadı."+ }+ },+ "uk" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Команді defaults не вдалося скопіювати %@."+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "defaults命令未能为%@制作副本。"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "defaults指令無法拷貝「%@」。"+ }+ }+ }+ },+ "The defaults command didn’t answer about %@." : {+ "localizations" : {+ "cs" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Příkaz defaults na dotaz ohledně %@ neodpověděl."+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Der Befehl „defaults“ hat zu %@ keine Antwort gegeben."+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "El comando defaults no ha respondido sobre %@."+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "La commande defaults n’a pas répondu au sujet de %@."+ }+ },+ "it" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Il comando defaults non ha risposto riguardo a %@."+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "defaultsコマンドから“%@”についての応答がありませんでした。"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "defaults 명령이 %@에 대해 응답하지 않았습니다."+ }+ },+ "nl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Het commando defaults gaf geen antwoord over %@."+ }+ },+ "pl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Polecenie defaults nie odpowiedziało na pytanie o domenę %@."+ }+ },+ "pt" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "O comando defaults não respondeu sobre %@."+ }+ },+ "ro" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Comanda defaults nu a dat niciun răspuns despre %@."+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Команда defaults не ответила на запрос о настройках %@."+ }+ },+ "sv" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Kommandot defaults svarade inte om %@."+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "defaults komutu %@ ayarları hakkında yanıt vermedi."+ }+ },+ "uk" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Команда defaults не відповіла щодо %@."+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "defaults命令没有就%@给出回应。"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "defaults指令對「%@」沒有回應。"+ }+ }+ }+ },"The disk that holds Peel’s folder has %@ free, and writing History needs %@. Peel removes nothing until there is room, so that everything it moves can be put back." : {"localizations" : {"cs" : {diff --git a/Packages/PeelCore/Sources/PeelCore/Removal/AppReset.swift b/Packages/PeelCore/Sources/PeelCore/Removal/AppReset.swiftindex 5d0f6c53..14289b2b 100644--- a/Packages/PeelCore/Sources/PeelCore/Removal/AppReset.swift+++ b/Packages/PeelCore/Sources/PeelCore/Removal/AppReset.swift@@ -82,7 +82,7 @@ public struct AppReset: Sendable {public struct Outcome: Sendable {public enum Stop: Sendable, Equatable {case removalsHeld(TrashFailure.Reason)- case settingsNotSaved+ case settingsNotSaved(PreferenceBackup.NotSaved)case appOpened}@@ -139,8 +139,8 @@ public struct AppReset: Sendable {}let urls = selected(selection)switch await save(urls) {- case .failed:- outcome.stop = .settingsNotSaved+ case .failed(let why):+ outcome.stop = .settingsNotSaved(why)return outcomecase .saved(let folder):outcome.backup = folderdiff --git a/Packages/PeelCore/Sources/PeelCore/Removal/PreferenceBackup.swift b/Packages/PeelCore/Sources/PeelCore/Removal/PreferenceBackup.swiftindex a81999b9..c1c551d1 100644--- a/Packages/PeelCore/Sources/PeelCore/Removal/PreferenceBackup.swift+++ b/Packages/PeelCore/Sources/PeelCore/Removal/PreferenceBackup.swift@@ -13,7 +13,27 @@ public enum PreferenceBackup {case nothingToSavecase saved(URL)/// The copy could not be made, so the reset must not clear anything.- case failed+ case failed(NotSaved)+ }++ /// Why a copy could not be made.+ public enum NotSaved: Sendable, Equatable {+ /// The app names no identifier a folder can be named after.+ case noUsableIdentifier+ /// `defaults` didn't answer about this domain: it didn't start, or ran out of time.+ case noAnswer(domain: String)+ /// The folder for the copy couldn't be made, and why, when Peel knows.+ case noFolder(FileProblem?)+ /// `defaults` couldn't export this domain.+ case notExported(domain: String)+ }++ /// Why a saved copy couldn't be read.+ public enum CopyUnreadable: Sendable, Equatable {+ case folderUnreadable(FileProblem)+ case noSettings+ /// None of its settings files is a property list `defaults import` reads.+ case notAPropertyList}/// What `defaults` answered: yes, no (it ran and said no, as for a domain that is not there), or nothing at@@ -47,7 +67,9 @@ public enum PreferenceBackup {run: Run) async -> Saved {let domains = PreferenceCleanup.domains(for: urls, ownedBy: app.bundleIdentifier)- guard let identifier = app.bundleIdentifier else { return domains.isEmpty ? .nothingToSave : .failed }+ guard let identifier = app.bundleIdentifier else {+ return domains.isEmpty ? .nothingToSave : .failed(.noUsableIdentifier)+ }return await save(domains, of: identifier, in: directory, through: service, run: run)}@@ -64,18 +86,23 @@ public enum PreferenceBackup {switch await run(domain.command("read")) {case .yes: domains.append(domain)case .no: continue- case .noAnswer: return .failed+ case .noAnswer: return .failed(.noAnswer(domain: domain.name))}}guard !domains.isEmpty else { return .nothingToSave }// The bundle identifier comes from the app itself and becomes part of a folder name, so it must have the// shape `copies` reads back, which rules out a `/` and a space.- guard- Identifier.isValid(bundleIdentifier),- let folder = PeelFolder.whileOpen(making: directory, { newFolder(for: bundleIdentifier, in: directory) })- ?? nil- else { return .failed }+ guard Identifier.isValid(bundleIdentifier) else { return .failed(.noUsableIdentifier) }+ let folder: URL+ let made = PeelFolder.whileOpen(making: directory) {+ Result { try newFolder(for: bundleIdentifier, in: directory) }+ }+ switch made {+ case .success(let new)?: folder = new+ case .failure(let error)?: return .failed(.noFolder(.failed(SystemError(error))))+ case nil: return .failed(.noFolder(nil))+ }for domain in domains {let file = folder.appending(path: fileName(for: domain))@@ -85,7 +112,7 @@ public enum PreferenceBackup {if rmdir(folder.path(percentEncoded: false)) != 0 {_ = await service.trashOwnFiles([folder])}- return .failed+ return .failed(.notExported(domain: domain.name))}}return .saved(folder)@@ -99,13 +126,13 @@ public enum PreferenceBackup {/// that part from scratch.case incomplete(clearedSome: Bool)/// The settings the app has now could not be saved, so nothing was cleared or put back.- case notSaved+ case notSaved(NotSaved)/// The app was open, and would write its own settings over the copy, so nothing was cleared or put back.case appIsOpen/// The exclusions aren't read yet or couldn't be read, so nothing was cleared or put back.case exclusionsNotKnown/// The copy couldn't be read or holds no settings that can be, so nothing was cleared or put back.- case copyUnreadable+ case copyUnreadable(CopyUnreadable)/// The app is excluded, so its settings were left alone.case excluded@@ -157,16 +184,22 @@ public enum PreferenceBackup {) async -> Restored {if let refusal = refusal(ofPuttingBack: bundleIdentifier, exclusions: exclusions) { return refusal }guard await !isOpen() else { return .appIsOpen }- let files = (try? FileManager.default.contentsOfDirectory(at: folder, includingPropertiesForKeys: nil)) ?? []+ let files: [URL]+ do {+ files = try FileManager.default.contentsOfDirectory(at: folder, includingPropertiesForKeys: nil)+ } catch {+ return .copyUnreadable(.folderUnreadable(.failed(SystemError(error))))+ }let saved = files.filter { $0.pathExtension == "plist" }.compactMap { file indomain(from: file.lastPathComponent).map { ($0, file) }}+ guard !saved.isEmpty else { return .copyUnreadable(.noSettings) }// A copy that is not a readable property list would put nothing back once the delete had cleared the// settings in use, so it is refused before anything is cleared.let readable = saved.filter { isAPropertyList($0.1) }- guard !readable.isEmpty else { return .copyUnreadable }+ guard !readable.isEmpty else { return .copyUnreadable(.notAPropertyList) }let current = await save(readable.map(\.0), of: bundleIdentifier, in: directory, through: service, run: run)- guard current != .failed else { return .notSaved }+ if case .failed(let why) = current { return .notSaved(why) }guard await !isOpen() else { return .appIsOpen }var clearedSome = falsefor (domain, file) in readable {@@ -214,18 +247,20 @@ public enum PreferenceBackup {.map(\.copy)}- /// Makes a new folder in `directory` for a copy of `bundleIdentifier`'s settings, named for the time. A copy- /// already made in that second keeps its folder, and this one takes the next number after the time.- private static func newFolder(for bundleIdentifier: String, in directory: URL) -> URL? {+ /// Makes a new folder in `directory` for a copy of `bundleIdentifier`'s settings, named for the time, or throws+ /// what macOS answered. A copy already made in that second keeps its folder, and this one takes the next number.+ private static func newFolder(for bundleIdentifier: String, in directory: URL) throws -> URL {let name = "\(bundleIdentifier) \(stamp())"- for number in 1...100 {+ var number = 1+ while true {let folder = directory.appending(path: number == 1 ? name : "\(name) \(number)", directoryHint: .isDirectory)- if (try? FileManager.default.createDirectory(at: folder, withIntermediateDirectories: false)) != nil {+ do {+ try FileManager.default.createDirectory(at: folder, withIntermediateDirectories: false)return folder+ } catch where folder.isThere && number < 100 {+ number += 1}- guard folder.isThere else { return nil }}- return nil}static func fileName(for domain: PreferenceCleanup.Domain) -> String {diff --git a/Packages/PeelCore/Tests/PeelCoreTests/AppResetTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/AppResetTests.swiftindex cdf44382..5b481007 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/AppResetTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/AppResetTests.swift@@ -359,14 +359,14 @@ struct AppResetTests {resettingPrivacy: true,through: try service(in: directory),isOpen: { false },- save: { _ in .failed },+ save: { _ in .failed(.noAnswer(domain: "com.example.app")) },resetPrivacy: { _ inasked.withLock { $0 = true }return .reset})- #expect(outcome.stop == .settingsNotSaved)+ #expect(outcome.stop == .settingsNotSaved(.noAnswer(domain: "com.example.app")))#expect(outcome.result.trashed.isEmpty)#expect(!asked.withLock { $0 })#expect(settings.isThere)diff --git a/Packages/PeelCore/Tests/PeelCoreTests/RemovalHygieneTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/RemovalHygieneTests.swiftindex f988bf5b..93c66d31 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/RemovalHygieneTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/RemovalHygieneTests.swift@@ -437,10 +437,43 @@ struct RemovalHygieneTests {from: folder, of: "com.example.app", in: backups, through: Self.service, run: run, isOpen: { false })- #expect(restored == .copyUnreadable, "a copy with nothing to read said only that not all went back")+ #expect(restored == .copyUnreadable(.notAPropertyList), "a copy with nothing to read said only that not all went back")#expect(asked.withLock { $0 }.isEmpty)}+ @Test(.permissionsHold) func saysWhyACopyCouldNotBeRead() async throws {+ let directory = try TemporaryDirectory()+ let backups = try directory.directory("Backups")+ let empty = try directory.directory("Backups/com.example.app 2026-09-24 101500")+ let closed = try directory.directory("Backups/com.example.app 2026-09-24 101501")+ try directory.setPermissions(0o000, of: closed)+ defer { try? directory.setPermissions(0o755, of: closed) }+ let restore = { (folder: URL) in+ await PreferenceBackup.restore(+ from: folder, of: "com.example.app", in: backups, through: Self.service, run: { _ in .yes },+ isOpen: { false }+ )+ }++ #expect(await restore(empty) == .copyUnreadable(.noSettings))+ let refusedRead = SystemError(domain: NSCocoaErrorDomain, code: NSFileReadNoPermissionError)+ #expect(await restore(closed) == .copyUnreadable(.folderUnreadable(.failed(refusedRead))))+ }++ @Test(.permissionsHold) func saysWhyTheCopysFolderCouldNotBeMade() async throws {+ let directory = try TemporaryDirectory()+ let backups = try directory.directory("Backups")+ try directory.setPermissions(0o500, of: backups)+ defer { try? directory.setPermissions(0o755, of: backups) }+ let app = InstalledApp(url: URL(filePath: "/Applications/Example.app"), bundleIdentifier: "com.example.app", name: "Example")+ let plist = URL.homeDirectory.appending(path: "Library/Preferences/com.example.app.plist")++ let saved = await PreferenceBackup.save([plist], for: app, in: backups, through: Self.service) { _ in .yes }++ let refusedWrite = SystemError(domain: NSCocoaErrorDomain, code: NSFileWriteNoPermissionError)+ #expect(saved == .failed(.noFolder(.failed(refusedWrite))))+ }+/// Put Back replaces what the app set since the reset, which may be a license entered again, so those settings/// are saved first, as a copy of their own, and only then cleared.@Test func puttingBackSavesTheSettingsInUseFirst() async throws {@@ -538,7 +571,7 @@ struct RemovalHygieneTests {through: Self.service,run: run,isOpen: { false }- ) == .notSaved+ ) == .notSaved(.notExported(domain: "com.example.app")))#expect(!asked.withLock { $0 }.contains { $0.first == "delete" || $0.first == "import" })}@@ -631,7 +664,7 @@ struct RemovalHygieneTests {let refused = await PreferenceBackup.save([plist], for: app, in: backups, through: Self.service) { arguments inarguments.contains("export") ? .no : .yes}- #expect(refused == .failed)+ #expect(refused == .failed(.notExported(domain: "com.example.app")))#expect(try FileManager.default.contentsOfDirectory(atPath: backups.path(percentEncoded: false)).isEmpty, "an empty copy was left behind")let nothing = await PreferenceBackup.save(@@ -655,7 +688,7 @@ struct RemovalHygieneTests {arguments.first == "read" ? .noAnswer : .yes}- #expect(saved == .failed)+ #expect(saved == .failed(.noAnswer(domain: "com.example.app")))#expect(try FileManager.default.contentsOfDirectory(atPath: backups.path(percentEncoded: false)).isEmpty)}diff --git a/Packages/PeelCore/Tests/PeelCoreTests/RemovalJournalTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/RemovalJournalTests.swiftindex 3d53d4ef..bac2b901 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/RemovalJournalTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/RemovalJournalTests.swift@@ -524,7 +524,7 @@ struct RemovalJournalTests {return .yes}- #expect(saved == .failed)+ #expect(saved == .failed(.notExported(domain: "com.example.app.helper")))#expect(moved.withLock { $0.count } == 1, "the half made copy did not go to the Trash")#expect(journal.entries().isEmpty)}diff --git a/Peel/Model/ResetPlan.swift b/Peel/Model/ResetPlan.swiftindex c22a9c2d..6fa7a371 100644--- a/Peel/Model/ResetPlan.swift+++ b/Peel/Model/ResetPlan.swift@@ -63,10 +63,10 @@ final class ResetPlan {outcome.map { $0.stop == nil } ?? false}- /// True when the settings could not be backed up, so nothing was moved. The backup is what restores them- /// once the app has written new ones, which History cannot do.- var couldNotSaveSettings: Bool {- outcome?.stop == .settingsNotSaved+ /// Why the settings could not be backed up, so nothing was moved, or nil. The backup is what restores them once+ /// the app has written new ones, which History cannot do.+ var whySettingsNotSaved: PreferenceBackup.NotSaved? {+ if case .settingsNotSaved(let why) = outcome?.stop { why } else { nil }}var backup: URL? {@@ -157,7 +157,7 @@ final class ResetPlan {/// Puts the settings saved in `backup` back, unless the app is open, which would write its own over them.func putSettingsBack(from backup: URL) async -> PreferenceBackup.Restored {// A copy is saved under the app's identifier, so an app with none has no copy to put back.- guard let identifier = app.bundleIdentifier else { return .notSaved }+ guard let identifier = app.bundleIdentifier else { return .notSaved(.noUsableIdentifier) }let restored = await QuitGuard.shared.run {await PreferenceBackup.restore(from: backup,diff --git a/Peel/Views/Presentation.swift b/Peel/Views/Presentation.swiftindex d3763c8a..b21d4c15 100644--- a/Peel/Views/Presentation.swift+++ b/Peel/Views/Presentation.swift@@ -305,6 +305,30 @@ extension ExclusionsStore {}}+extension PreferenceBackup.NotSaved {+ /// Why a copy of an app's settings couldn't be made, as a sentence of its own.+ var sentence: String {+ switch self {+ case .noUsableIdentifier: String(localized: "The app has no identifier Peel can name a copy after.")+ case .noAnswer(let domain): String(localized: "The defaults command didn’t answer about \(domain).")+ case .notExported(let domain): String(localized: "The defaults command couldn’t copy \(domain).")+ case .noFolder(let why):+ why.said(after: String(localized: "Peel couldn’t make a folder for the copy."), about: PreferenceBackup.defaultDirectory)+ }+ }+}++extension PreferenceBackup.CopyUnreadable {+ /// Why the copy in `folder` couldn't be read, as a sentence of its own.+ func sentence(about folder: URL) -> String {+ switch self {+ case .folderUnreadable(let why): why.said(after: String(localized: "Peel couldn’t open the copy’s folder."), about: folder)+ case .noSettings: String(localized: "The copy holds no settings file.")+ case .notAPropertyList: String(localized: "The copy’s settings files aren’t in a form Peel can read.")+ }+ }+}+extension HistoryWriteProblem {/// What keeps History from being written, and that nothing moves meanwhile, read from `bundle`, or from the main/// bundle when it is nil.diff --git a/Peel/Views/ResetSheet.swift b/Peel/Views/ResetSheet.swiftindex 7d37fe1b..912cf273 100644--- a/Peel/Views/ResetSheet.swift+++ b/Peel/Views/ResetSheet.swift@@ -117,10 +117,10 @@ struct ResetSheet: View {UnreadableFoldersNotice(folders: [], needsFullDiskAccess: true)}- if plan.couldNotSaveSettings {+ if let why = plan.whySettingsNotSaved {Notice(title: Text("Nothing was reset"),- detail: Text("Peel couldn’t save a copy of the settings first, so it moved nothing.")+ detail: Text(verbatim: [String(localized: "Peel couldn’t save a copy of the settings first, so it moved nothing."), why.sentence].joined(separator: " "))) { EmptyView() }.listRowSeparator(.hidden)}@@ -322,9 +322,9 @@ struct ResetSheet: View {}}if let refusal = plan.putBackRefusal {- putBackResult(refusal)+ putBackResult(refusal, from: backup)} else if let putBack {- putBackResult(putBack)+ putBackResult(putBack, from: backup)}}.padding(.vertical, 2)@@ -374,7 +374,7 @@ struct ResetSheet: View {/// What Put Settings Back did, each way it can end.@ViewBuilder- private func putBackResult(_ restored: PreferenceBackup.Restored) -> some View {+ private func putBackResult(_ restored: PreferenceBackup.Restored, from copy: URL) -> some View {switch restored {case .complete:Text("The settings are back as they were.")@@ -389,12 +389,14 @@ struct ResetSheet: View {}.font(.callout).foregroundStyle(.secondary)- case .notSaved:- StatusLabel(title: Text("Peel couldn’t save the settings \(plan.app.name) has now, so it put nothing back."), tint: .red)+ case .notSaved(let why):+ let said = String(localized: "Peel couldn’t save the settings \(plan.app.name) has now, so it put nothing back.")+ StatusLabel(title: Text(verbatim: [said, why.sentence].joined(separator: " ")), tint: .red).font(.callout).foregroundStyle(.secondary)- case .copyUnreadable:- StatusLabel(title: Text("Peel couldn’t read the settings saved for \(plan.app.name), so it put nothing back."), tint: .red)+ case .copyUnreadable(let why):+ let said = String(localized: "Peel couldn’t read the settings saved for \(plan.app.name), so it put nothing back.")+ StatusLabel(title: Text(verbatim: [said, why.sentence(about: copy)].joined(separator: " ")), tint: .red).font(.callout).foregroundStyle(.secondary)case .appIsOpen:diff --git a/Peel/Views/Settings/SavedSettingsSection.swift b/Peel/Views/Settings/SavedSettingsSection.swiftindex 3c50a21e..00d7e669 100644--- a/Peel/Views/Settings/SavedSettingsSection.swift+++ b/Peel/Views/Settings/SavedSettingsSection.swift@@ -159,10 +159,10 @@ struct SavedSettingsSection: View {? String(localized: "The settings that didn’t go back were cleared first, so the app starts them from scratch. The copy is still here to try again."): "")- case .notSaved:- failure = Failure(title: String(localized: "Peel couldn’t save the settings \(name) has now, so it put nothing back."), message: "")- case .copyUnreadable:- failure = Failure(title: String(localized: "Peel couldn’t read the settings saved for \(name), so it put nothing back."), message: "")+ case .notSaved(let why):+ failure = Failure(title: String(localized: "Peel couldn’t save the settings \(name) has now, so it put nothing back."), message: why.sentence)+ case .copyUnreadable(let why):+ failure = Failure(title: String(localized: "Peel couldn’t read the settings saved for \(name), so it put nothing back."), message: why.sentence(about: copy.folder))case .appIsOpen:failure = Failure(title: String(localized: "Quit \(name) first, or it can write its own settings over these."), message: "")case .exclusionsNotKnown: