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.

Read Desktop and Documents where iCloud Drive keeps them

Țugui Dragoș6d1865b03c8a
diff --git a/GUIDE.md b/GUIDE.md
index b91ecea3..ed0b435e 100644
--- a/GUIDE.md
+++ b/GUIDE.md
@@ -144,7 +144,8 @@ Space shows what fills your disk, area by area, and what each area is.
devices. A disk image can also be one you made to keep files in, so look before you select it. An installer,
download, or update smaller than 20 MB isn't listed.
- **iCloud Drive:** files already safe in iCloud that are also downloaded to this Mac, as Finder shows them: what is
- in iCloud Drive and each app's documents, never an app's own data. An app's documents are listed and not selected,
+ in iCloud Drive, your Desktop and Documents when iCloud Drive keeps them, and each app's documents, never an app's
+ own data. An app's documents are listed and not selected,
since Finder may not show them and the app may expect them on this Mac. Downloads are listed in the folders Finder
shows them in, named as Finder names them, the biggest first, and a folder's checkbox selects every file in it that
Peel recommends; a file that would free less than 1 MB isn't listed. Remove Downloads, as in Finder, takes away only
@@ -415,7 +416,7 @@ and takes you straight to the right place in System Settings, or, for the comman
| App Management | Move another developer's app to the Trash. Without it, Peel can still clear an app's files, but macOS may refuse to move the app itself. |
| Helper | Move to the Trash, and put back, what sits in folders only an administrator can change, such as an app's leftovers, the caches and logs Space lists for every account, and an installer package's files and receipt, and start, stop, enable, or disable other developers' background items that run as root. It answers administrators only. macOS asks you to approve it once in Login Items & Extensions, and an update of Peel brings its new helper with it. |
| Notifications (optional) | Tell you when your apps have updates, when Homebrew finishes an upgrade or runs into a problem, when your disk is almost full if you turn that warning on, and, with Watch the Trash on, when you move an app to the Trash yourself. While they're off, Settings > General says so under those two switches. |
-| Folders macOS asks about | Without Full Disk Access, macOS asks the first time Peel looks in Desktop, Documents, or Downloads for installers, duplicates, and what builds left, or at your cloud folders to measure them. On macOS 26 it also asks before Peel looks inside another app's data for what it would leave behind; on macOS 27 it refuses without asking, and Peel says which folders it couldn't read. |
+| Folders macOS asks about | Without Full Disk Access, macOS asks the first time Peel looks in Desktop, Documents, or Downloads for installers, duplicates, what builds left, and what iCloud Drive keeps there, or at your cloud folders to measure them. On macOS 26 it also asks before Peel looks inside another app's data for what it would leave behind; on macOS 27 it refuses without asking, and Peel says which folders it couldn't read. |
| Finder Extension (optional) | Add Uninstall with Peel to the menu you get when you Control-click an app in Finder. |
| Open at Login (optional) | Start Peel when you log in. With Show in Menu Bar on, it keeps running after you close its window, so Watch the Trash keeps working. |
| Command Line (optional) | Use `peel` from anywhere in Terminal. Home's Copy button, like Settings > General, copies the command that puts it on your path, and Terminal asks for your password when you run it. |
diff --git a/Localization/Peel/InfoPlist.xcstrings b/Localization/Peel/InfoPlist.xcstrings
index 2caebf1e..b4662887 100644
--- a/Localization/Peel/InfoPlist.xcstrings
+++ b/Localization/Peel/InfoPlist.xcstrings
@@ -126,109 +126,109 @@
"cs" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Peel tu hledá instalátory a duplicitní soubory. Dokud k tomu nedáte pokyn, nic se neodstraní."
+ "value" : "Peel tu hledá instalátory a duplicitní soubory a také stažené položky z iCloudu, které může odstranit, když je tato složka na iCloud Drivu. Dokud k tomu nedáte pokyn, nic se neodstraní."
}
},
"de" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Peel sucht hier nach Installern und doppelten Dateien. Ohne deine Zustimmung wird nichts entfernt."
+ "value" : "Peel sucht hier nach Installern und doppelten Dateien sowie nach iCloud-Downloads, die Peel entfernen kann, wenn dieser Ordner in iCloud Drive liegt. Ohne deine Zustimmung wird nichts entfernt."
}
},
"en" : {
"stringUnit" : {
"state" : "new",
- "value" : "Peel looks here for installers and duplicate files. Nothing is removed until you say so."
+ "value" : "Peel looks here for installers and duplicate files, and for iCloud downloads it can remove when this folder is in iCloud Drive. Nothing is removed until you say so."
}
},
"es" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Peel busca aquí instaladores y archivos duplicados. No se elimina nada hasta que tú lo digas."
+ "value" : "Peel busca aquí instaladores y archivos duplicados, y descargas de iCloud que puede eliminar cuando esta carpeta está en iCloud Drive. No se elimina nada hasta que tú lo digas."
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Peel recherche ici des programmes d’installation et des fichiers en double. Rien n’est supprimé tant que vous ne l’avez pas demandé."
+ "value" : "Peel recherche ici des programmes d’installation et des fichiers en double, ainsi que des téléchargements iCloud qu’il peut retirer lorsque ce dossier se trouve dans iCloud Drive. Rien n’est supprimé tant que vous ne l’avez pas demandé."
}
},
"it" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Peel cerca qui installer e file duplicati. Non viene rimosso nulla finché non lo dici tu."
+ "value" : "Peel cerca qui installer e file duplicati, e i download di iCloud che può rimuovere quando questa cartella è su iCloud Drive. Non viene rimosso nulla finché non lo dici tu."
}
},
"ja" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Peelはここでインストーラや重複ファイルを探します。指示するまで、何もゴミ箱に入れません。"
+ "value" : "Peelはここでインストーラや重複ファイルを探します。また、このフォルダがiCloud Driveにある場合は、iCloudからダウンロードしたもののうち削除できるものも探します。指示するまで、何もゴミ箱に入れません。"
}
},
"ko" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Peel은 이곳에서 설치 프로그램과 중복된 파일을 찾습니다. 사용자가 요청하기 전에는 아무것도 제거되지 않습니다."
+ "value" : "Peel은 이곳에서 설치 프로그램과 중복된 파일을 찾고, 이 폴더가 iCloud Drive에 있으면 제거할 수 있는 iCloud 다운로드도 찾습니다. 사용자가 요청하기 전에는 아무것도 제거되지 않습니다."
}
},
"nl" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Peel zoekt hier naar installatieprogramma's en dubbele bestanden. Er wordt niets verwijderd totdat jij dat zegt."
+ "value" : "Peel zoekt hier naar installatieprogramma's en dubbele bestanden, en naar iCloud-downloads die het kan verwijderen als deze map op iCloud Drive staat. Er wordt niets verwijderd totdat jij dat zegt."
}
},
"pl" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Peel szuka tutaj instalatorów i zduplikowanych plików. Nic nie trafi do Kosza, dopóki o tym nie zdecydujesz."
+ "value" : "Peel szuka tutaj instalatorów i zduplikowanych plików, a także pobranych rzeczy z iCloud, które może usunąć, gdy ten folder jest na iCloud Drive. Nic nie trafi do Kosza, dopóki o tym nie zdecydujesz."
}
},
"pt" : {
"stringUnit" : {
"state" : "translated",
- "value" : "O Peel procura aqui instaladores e arquivos duplicados. Nada é removido até você pedir."
+ "value" : "O Peel procura aqui instaladores e arquivos duplicados, e downloads do iCloud que ele pode remover quando esta pasta está no iCloud Drive. Nada é removido até você pedir."
}
},
"ro" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Peel caută aici programe de instalare și fișiere duplicate. Nu se elimină nimic până nu cereți dvs."
+ "value" : "Peel caută aici programe de instalare și fișiere duplicate, precum și descărcări iCloud pe care le poate elimina când acest dosar este pe iCloud Drive. Nu se elimină nimic până nu cereți dvs."
}
},
"ru" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Peel ищет здесь установщики и дубликаты файлов. Ничего не удаляется без Вашего решения."
+ "value" : "Peel ищет здесь установщики и дубликаты файлов, а также загрузки iCloud, которые он может удалить, когда эта папка находится в iCloud Drive. Ничего не удаляется без Вашего решения."
}
},
"sv" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Peel letar här efter installerare och dubblettfiler. Inget tas bort förrän du säger till."
+ "value" : "Peel letar här efter installerare och dubblettfiler, och efter iCloud-hämtningar som Peel kan ta bort när den här mappen ligger i iCloud Drive. Inget tas bort förrän du säger till."
}
},
"tr" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Peel burada yükleyicileri ve yinelenen dosyaları arar. Siz söyleyene kadar hiçbir şey kaldırılmaz."
+ "value" : "Peel burada yükleyicileri ve yinelenen dosyaları, bu klasör iCloud Drive’daysa kaldırabileceği iCloud indirilenlerini de arar. Siz söyleyene kadar hiçbir şey kaldırılmaz."
}
},
"uk" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Peel шукає тут інсталятори й файли-дублікати. Нічого не вилучається, доки ви не скажете."
+ "value" : "Peel шукає тут інсталятори й файли-дублікати, а також викачування iCloud, які може вилучити, коли ця папка зберігається в iCloud Drive. Нічого не вилучається, доки ви не скажете."
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Peel会在这里查找安装器和重复文件。在你确认之前,不会移除任何内容。"
+ "value" : "Peel会在这里查找安装器和重复文件;如果此文件夹位于iCloud云盘中,还会查找可以移除的iCloud下载。在你确认之前,不会移除任何内容。"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Peel會在這裡尋找安裝程式和重複的檔案。在你下達指示之前,不會移除任何項目。"
+ "value" : "Peel會在這裡尋找安裝程式和重複的檔案;當此檔案夾位於「iCloud雲碟」中時,也會尋找它可以移除的iCloud下載項目。在你下達指示之前,不會移除任何項目。"
}
}
}
@@ -239,109 +239,109 @@
"cs" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Peel tu hledá instalátory, duplicitní soubory a to, co zbylo po sestavení. Dokud k tomu nedáte pokyn, nic se neodstraní."
+ "value" : "Peel tu hledá instalátory, duplicitní soubory a to, co zbylo po sestavení, a také stažené položky z iCloudu, které může odstranit, když je tato složka na iCloud Drivu. Dokud k tomu nedáte pokyn, nic se neodstraní."
}
},
"de" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Peel sucht hier nach Installern, doppelten Dateien und dem, was Builds hinterlassen haben. Ohne deine Zustimmung wird nichts entfernt."
+ "value" : "Peel sucht hier nach Installern, doppelten Dateien und dem, was Builds hinterlassen haben, sowie nach iCloud-Downloads, die Peel entfernen kann, wenn dieser Ordner in iCloud Drive liegt. Ohne deine Zustimmung wird nichts entfernt."
}
},
"en" : {
"stringUnit" : {
"state" : "new",
- "value" : "Peel looks here for installers, duplicate files, and what builds left behind. Nothing is removed until you say so."
+ "value" : "Peel looks here for installers, duplicate files, and what builds left behind, and for iCloud downloads it can remove when this folder is in iCloud Drive. Nothing is removed until you say so."
}
},
"es" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Peel busca aquí instaladores, archivos duplicados y lo que dejaron las compilaciones. No se elimina nada hasta que tú lo digas."
+ "value" : "Peel busca aquí instaladores, archivos duplicados y lo que dejaron las compilaciones, y descargas de iCloud que puede eliminar cuando esta carpeta está en iCloud Drive. No se elimina nada hasta que tú lo digas."
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Peel recherche ici des programmes d’installation, des fichiers en double et ce que les compilations ont laissé derrière elles. Rien n’est supprimé tant que vous ne l’avez pas demandé."
+ "value" : "Peel recherche ici des programmes d’installation, des fichiers en double et ce que les compilations ont laissé derrière elles, ainsi que des téléchargements iCloud qu’il peut retirer lorsque ce dossier se trouve dans iCloud Drive. Rien n’est supprimé tant que vous ne l’avez pas demandé."
}
},
"it" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Peel cerca qui installer, file duplicati e ciò che le build si sono lasciate dietro. Non viene rimosso nulla finché non lo dici tu."
+ "value" : "Peel cerca qui installer, file duplicati e ciò che le build si sono lasciate dietro, e i download di iCloud che può rimuovere quando questa cartella è su iCloud Drive. Non viene rimosso nulla finché non lo dici tu."
}
},
"ja" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Peelはここでインストーラ、重複ファイル、ビルドが残したものを探します。指示するまで、何もゴミ箱に入れません。"
+ "value" : "Peelはここでインストーラ、重複ファイル、ビルドが残したものを探します。また、このフォルダがiCloud Driveにある場合は、iCloudからダウンロードしたもののうち削除できるものも探します。指示するまで、何もゴミ箱に入れません。"
}
},
"ko" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Peel은 이곳에서 설치 프로그램, 중복된 파일, 빌드가 남긴 항목을 찾습니다. 사용자가 요청하기 전에는 아무것도 제거되지 않습니다."
+ "value" : "Peel은 이곳에서 설치 프로그램, 중복된 파일, 빌드가 남긴 항목을 찾고, 이 폴더가 iCloud Drive에 있으면 제거할 수 있는 iCloud 다운로드도 찾습니다. 사용자가 요청하기 전에는 아무것도 제거되지 않습니다."
}
},
"nl" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Peel zoekt hier naar installatieprogramma's, dubbele bestanden en wat builds hebben achtergelaten. Er wordt niets verwijderd totdat jij dat zegt."
+ "value" : "Peel zoekt hier naar installatieprogramma's, dubbele bestanden en wat builds hebben achtergelaten, en naar iCloud-downloads die het kan verwijderen als deze map op iCloud Drive staat. Er wordt niets verwijderd totdat jij dat zegt."
}
},
"pl" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Peel szuka tutaj instalatorów, zduplikowanych plików i tego, co pozostawiły kompilacje. Nic nie trafi do Kosza, dopóki o tym nie zdecydujesz."
+ "value" : "Peel szuka tutaj instalatorów, zduplikowanych plików i tego, co pozostawiły kompilacje, a także pobranych rzeczy z iCloud, które może usunąć, gdy ten folder jest na iCloud Drive. Nic nie trafi do Kosza, dopóki o tym nie zdecydujesz."
}
},
"pt" : {
"stringUnit" : {
"state" : "translated",
- "value" : "O Peel procura aqui instaladores, arquivos duplicados e o que as compilações deixaram para trás. Nada é removido até você pedir."
+ "value" : "O Peel procura aqui instaladores, arquivos duplicados e o que as compilações deixaram para trás, e downloads do iCloud que ele pode remover quando esta pasta está no iCloud Drive. Nada é removido até você pedir."
}
},
"ro" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Peel caută aici programe de instalare, fișiere duplicate și ce au lăsat în urmă compilările. Nu se elimină nimic până nu cereți dvs."
+ "value" : "Peel caută aici programe de instalare, fișiere duplicate și ce au lăsat în urmă compilările, precum și descărcări iCloud pe care le poate elimina când acest dosar este pe iCloud Drive. Nu se elimină nimic până nu cereți dvs."
}
},
"ru" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Peel ищет здесь установщики, дубликаты файлов и то, что осталось после сборок. Ничего не удаляется без Вашего решения."
+ "value" : "Peel ищет здесь установщики, дубликаты файлов и то, что осталось после сборок, а также загрузки iCloud, которые он может удалить, когда эта папка находится в iCloud Drive. Ничего не удаляется без Вашего решения."
}
},
"sv" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Peel letar här efter installerare, dubblettfiler och det som byggen har lämnat kvar. Inget tas bort förrän du säger till."
+ "value" : "Peel letar här efter installerare, dubblettfiler och det som byggen har lämnat kvar, och efter iCloud-hämtningar som Peel kan ta bort när den här mappen ligger i iCloud Drive. Inget tas bort förrän du säger till."
}
},
"tr" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Peel burada yükleyicileri, yinelenen dosyaları ve derlemelerin geride bıraktıklarını arar. Siz söyleyene kadar hiçbir şey kaldırılmaz."
+ "value" : "Peel burada yükleyicileri, yinelenen dosyaları ve derlemelerin geride bıraktıklarını, bu klasör iCloud Drive’daysa kaldırabileceği iCloud indirilenlerini de arar. Siz söyleyene kadar hiçbir şey kaldırılmaz."
}
},
"uk" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Peel шукає тут інсталятори, файли-дублікати й те, що залишили по собі збірки. Нічого не вилучається, доки ви не скажете."
+ "value" : "Peel шукає тут інсталятори, файли-дублікати й те, що залишили по собі збірки, а також викачування iCloud, які може вилучити, коли ця папка зберігається в iCloud Drive. Нічого не вилучається, доки ви не скажете."
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Peel会在这里查找安装器、重复文件以及构建留下的内容。在你确认之前,不会移除任何内容。"
+ "value" : "Peel会在这里查找安装器、重复文件以及构建留下的内容;如果此文件夹位于iCloud云盘中,还会查找可以移除的iCloud下载。在你确认之前,不会移除任何内容。"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Peel會在這裡尋找安裝程式、重複的檔案,以及建置留下的項目。在你下達指示之前,不會移除任何項目。"
+ "value" : "Peel會在這裡尋找安裝程式、重複的檔案,以及建置留下的項目;當此檔案夾位於「iCloud雲碟」中時,也會尋找它可以移除的iCloud下載項目。在你下達指示之前,不會移除任何項目。"
}
}
}
diff --git a/Localization/Peel/Localizable.xcstrings b/Localization/Peel/Localizable.xcstrings
index f2c6da6a..0bef23f1 100644
--- a/Localization/Peel/Localizable.xcstrings
+++ b/Localization/Peel/Localizable.xcstrings
@@ -238623,6 +238623,112 @@
}
}
},
+ "macOS didn’t let Peel read %@ in iCloud Drive, so this list isn’t all of it. Full Disk Access in System Settings gives Peel what it needs." : {
+ "localizations" : {
+ "cs" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Systém macOS nedovolil Peelu přečíst %@ na iCloud Drivu, takže tento seznam není úplný. Plný přístup k disku v Nastavení systému dá Peelu, co potřebuje."
+ }
+ },
+ "de" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS hat Peel nicht erlaubt, %@ in iCloud Drive zu lesen, daher ist diese Liste nicht vollständig. Festplattenvollzugriff in den Systemeinstellungen gibt Peel, was dafür nötig ist."
+ }
+ },
+ "es" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS no ha dejado que Peel lea %@ en iCloud Drive, así que esta lista no lo incluye todo. El acceso total al disco en Ajustes del Sistema le da a Peel lo que necesita."
+ }
+ },
+ "fr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS n’a pas laissé Peel lire %@ dans iCloud Drive : cette liste est donc incomplète. L’accès complet au disque, dans Réglages Système, donne à Peel ce dont il a besoin."
+ }
+ },
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS non ha permesso a Peel di leggere %@ su iCloud Drive, quindi questo elenco non è completo. L’accesso completo al disco in Impostazioni di Sistema dà a Peel ciò che gli serve."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOSがPeelにiCloud Drive内の%@の読み取りを許可しなかったため、この一覧にはすべてが含まれているわけではありません。システム設定でフルディスクアクセスを許可すると、Peelは必要なものを読み取れるようになります。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS가 Peel이 iCloud Drive의 %@을(를) 읽지 못하게 했으므로 이 목록이 전부는 아닙니다. 시스템 설정에서 Peel에 전체 디스크 접근 권한을 부여하면 읽을 수 있습니다."
+ }
+ },
+ "nl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS liet Peel %@ op iCloud Drive niet lezen, dus deze lijst is niet volledig. Met volledige schijftoegang in Systeeminstellingen krijgt Peel wat het nodig heeft."
+ }
+ },
+ "pl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS nie pozwolił aplikacji Peel odczytać na iCloud Drive: %@, więc ta lista nie jest pełna. Pełny dostęp do dysku w Ustawieniach systemowych zapewni aplikacji Peel to, czego potrzebuje."
+ }
+ },
+ "pt" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "O macOS não deixou o Peel ler %@ no iCloud Drive, então esta lista não está completa. O Acesso Total ao Disco, nos Ajustes do Sistema, dá ao Peel aquilo de que ele precisa."
+ }
+ },
+ "ro" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS nu i‑a permis aplicației Peel să citească %@ de pe iCloud Drive, așa că această listă nu este completă. Acces complet la disc, din Configurări sistem, îi oferă aplicației Peel ceea ce îi trebuie."
+ }
+ },
+ "ru" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS не позволила Peel прочитать %@ в iCloud Drive, поэтому в этом списке показано не все. Полный доступ к диску в Системных настройках даст Peel все необходимое."
+ }
+ },
+ "sv" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS lät inte Peel läsa %@ i iCloud Drive, så listan visar inte allt. Med full skivtillgång i Systeminställningar får Peel det som behövs."
+ }
+ },
+ "tr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS, Peel’in iCloud Drive’daki %@ içeriğini okumasına izin vermedi, bu yüzden bu liste eksik. Sistem Ayarları’ndaki Tam Disk Erişimi, Peel’e gereken izni verir."
+ }
+ },
+ "uk" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS не дала Peel прочитати %@ в iCloud Drive, тож цей список показує не все. Повний доступ до диска в Системних параметрах дасть Peel те, що їй потрібно."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS不允许Peel读取iCloud云盘中的“%@”,因此此列表并不完整。在“系统设置”中授予Peel完全磁盘访问权限,它就能读取了。"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS不讓Peel讀取「iCloud雲碟」中的%@,因此此列表並不完整。在「系統設定」中給予「完全取用磁碟」權限,Peel就能取得所需的存取權限。"
+ }
+ }
+ }
+ },
"macOS didn’t list the agents and daemons that apps added, so some may be missing here." : {
"localizations" : {
"cs" : {
diff --git a/Packages/PeelCore/Sources/PeelCore/Space/CloudFolders.swift b/Packages/PeelCore/Sources/PeelCore/Space/CloudFolders.swift
index 7a8c8d75..236b0839 100644
--- a/Packages/PeelCore/Sources/PeelCore/Space/CloudFolders.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Space/CloudFolders.swift
@@ -44,16 +44,27 @@ extension CloudStorage {
}
return CloudFolder.ordered(grouped.values.map { files in
let folder = files[0].url.deletingLastPathComponent()
- let shown = names(of: folder, container: files[0].container, under: root)
+ let shown = names(of: folder, container: files[0].container, under: root, home: home)
return CloudFolder(url: folder, names: shown, files: files)
})
}
- /// Finder shows an app's `Documents` as the app's folder itself, so that name is left out.
- static func names(of folder: URL, container: String, under root: URL) -> [String] {
+ /// Finder shows an app's `Documents` as the app's folder itself, so that name is left out, and a folder of the
+ /// home that iCloud Drive keeps inside iCloud Drive.
+ static func names(of folder: URL, container: String, under root: URL, home: URL) -> [String] {
let rootNames = PathComponents.of(PathPattern.comparablePath(of: root))
let names = PathComponents.of(PathPattern.comparablePath(of: folder))
- guard names.count > rootNames.count, names.starts(with: rootNames) else { return [folder.lastPathComponent] }
+ guard names.count > rootNames.count, names.starts(with: rootNames) else {
+ let homeNames = PathComponents.of(PathPattern.comparablePath(of: home))
+ guard names.count > homeNames.count, names.starts(with: homeNames) else {
+ return [folder.lastPathComponent]
+ }
+ var place = home
+ return [container] + names.dropFirst(homeNames.count).map { name in
+ place = place.appending(path: name, directoryHint: .isDirectory)
+ return FileManager.default.displayName(atPath: place.path(percentEncoded: false))
+ }
+ }
var place = root.appending(path: names[rootNames.count], directoryHint: .isDirectory)
var shown = [container]
for (depth, name) in names.dropFirst(rootNames.count + 1).enumerated() {
diff --git a/Packages/PeelCore/Sources/PeelCore/Space/CloudStorage.swift b/Packages/PeelCore/Sources/PeelCore/Space/CloudStorage.swift
index 3757904d..d9a39c2b 100644
--- a/Packages/PeelCore/Sources/PeelCore/Space/CloudStorage.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Space/CloudStorage.swift
@@ -40,6 +40,8 @@ public struct CloudScan: Sendable {
public var folders: [CloudFolder] = []
/// iCloud Drive was never set up for this account: the folder iCloud keeps in the home isn't there.
public var isNotSetUp = false
+ /// The folders of the home iCloud Drive keeps that macOS would not let Peel read: Desktop, Documents.
+ public var unreadableFolders: [String] = []
public enum CutShort: Sendable, Equatable {
/// The walk ran out of time or was stopped before it read everything.
@@ -81,8 +83,9 @@ public enum CloudStorage {
/// The most files listed. The walk goes on past it, keeping the biggest files it finds, so a big file read late
/// is not left out for smaller ones read first.
public static let maximumFiles = 5_000
- /// How long the walk may take, in seconds. A folder iCloud manages can stall a directory read for minutes,
- /// and this walk also reads the sync state of every file.
+ /// How long each walk may take, in seconds: of `Mobile Documents`, and of each folder of the home iCloud Drive
+ /// keeps, so a Documents folder of many small files costs the others nothing. A folder iCloud manages can stall a
+ /// directory read for minutes, and a walk also reads the sync state of every file.
public static let budget: TimeInterval = 20
/// True only for a file whose local copy is current and already safely in iCloud. A file not yet uploaded,
@@ -138,35 +141,62 @@ public enum CloudStorage {
exclusions: Exclusions,
desktopPictures: Set<URL>,
within budget: TimeInterval,
+ while isAsked: @escaping @Sendable () -> Bool = AppDataQuestion.isOnScreen,
+ isSafe: @escaping @Sendable (URLResourceValues) -> Bool = isSafeToFree(_:),
isDataless: @escaping @Sendable (URL) -> Bool
) async -> CloudScan {
let collector = Collector()
let scan = ScanCount.current
- let finished = await SlowRead.answer(within: budget) { isGivenUp in
- collect(
- home: home,
- minimumSize: minimumSize,
- exclusions: exclusions,
- desktopPictures: desktopPictures,
- into: collector,
- deadline: .now + .seconds(budget),
- countingFor: scan,
- isDataless: isDataless,
- unless: isGivenUp
- )
- return true
+ func walk(_ folder: URL?) async -> Bool {
+ await SlowRead.answer(within: budget, while: isAsked) { isGivenUp in
+ collect(
+ home: home,
+ minimumSize: minimumSize,
+ exclusions: exclusions,
+ desktopPictures: desktopPictures,
+ keptInTheHome: folder,
+ into: collector,
+ countingFor: scan,
+ isSafe: isSafe,
+ isDataless: isDataless,
+ unless: isGivenUp
+ )
+ return true
+ } != nil
+ }
+ var isWhole = await walk(nil)
+ let kept = await SlowRead.answer(within: budget, while: isAsked) { _ in foldersKeptInTheHome(home: home) }
+ if kept == nil { isWhole = false }
+ for folder in kept ?? [] {
+ let finished = await walk(folder)
+ isWhole = isWhole && finished
}
let collected = collector.collected
return CloudScan(
files: collected.files.sorted { $0.size > $1.size },
- cutShort: finished == nil ? .ranOutOfTime : collected.cutShort,
+ cutShort: isWhole ? collected.cutShort : .ranOutOfTime,
couldNotRead: collected.couldNotRead,
sharedDownloads: collected.sharedDownloads,
folders: folders(of: collected.files, home: home),
- isNotSetUp: !isSetUp(home: home)
+ isNotSetUp: !isSetUp(home: home),
+ unreadableFolders: collected.unreadableFolders
)
}
+ /// The folders of the home iCloud Drive keeps: Desktop and Documents, which System Settings turns on together.
+ /// macOS leaves them where they are and puts a link to each in iCloud Drive, where Finder shows it
+ /// (`NSFileProviderKnownFolders.h`), so the link says so, and a walk of iCloud Drive doesn't go through it.
+ static func foldersKeptInTheHome(home: URL) -> [URL] {
+ let drive = home.appending(path: "Library/Mobile Documents/com~apple~CloudDocs", directoryHint: .isDirectory)
+ return ["Desktop", "Documents"].compactMap { name in
+ let link = drive.appending(path: name).path(percentEncoded: false)
+ let folder = home.appending(path: name, directoryHint: .isDirectory)
+ guard let destination = try? FileManager.default.destinationOfSymbolicLink(atPath: link) else { return nil }
+ let leadsTo = URL(filePath: destination, relativeTo: drive)
+ return PathPattern.comparablePath(of: leadsTo) == PathPattern.comparablePath(of: folder) ? folder : nil
+ }
+ }
+
/// What the walk has gathered so far, written by the thread that walks and read once it stops or the
/// budget runs out.
final class Collector: Sendable {
@@ -175,6 +205,7 @@ public enum CloudStorage {
var cutShort: CloudScan.CutShort?
var couldNotRead = false
var sharedDownloads = 0
+ var unreadableFolders: [String] = []
}
private let state = Mutex(Collected())
@@ -234,28 +265,34 @@ public enum CloudStorage {
state.withLock { $0.couldNotRead = true }
}
+ func unreadable(_ folder: URL) {
+ let name = FileManager.default.displayName(atPath: folder.path(percentEncoded: false))
+ state.withLock { $0.unreadableFolders.append(name) }
+ }
+
func leftOutAsShared() {
state.withLock { $0.sharedDownloads += 1 }
}
}
- /// Walks iCloud Drive and adds each file worth freeing to `collector`. Stops at `deadline` as well as when
- /// `isGivenUp` says so, because the timer behind `isGivenUp` runs on another thread and can fire late on a
- /// busy Mac. Only iCloud can say a file is safely there, so a test says it through `isSafe`.
+ /// Walks iCloud Drive, or `folder` of the home that it keeps, and adds each file worth freeing to `collector`,
+ /// until `isGivenUp` says to stop. Only iCloud can say a file is safely there, so a test says it through `isSafe`.
static func collect(
home: URL,
minimumSize: Int64,
exclusions: Exclusions,
desktopPictures: Set<URL> = [],
+ keptInTheHome folder: URL? = nil,
into collector: Collector,
- deadline: ContinuousClock.Instant,
countingFor scan: ScanCount?,
isSafe: (URLResourceValues) -> Bool = isSafeToFree(_:),
isPinned: (URL) -> Bool = isPinned(_:),
isDataless: (URL) -> Bool = FileSize.isDataless(_:),
unless isGivenUp: () -> Bool
) {
- let root = home.appending(path: "Library/Mobile Documents", directoryHint: .isDirectory)
+ let cloud = home.appending(path: "Library/Mobile Documents", directoryHint: .isDirectory)
+ let root = folder ?? cloud
+ guard !exclusions.excludes(root) else { return }
let rootPath = PathPattern.comparablePath(of: root)
let pictures = Set(desktopPictures.map(PathPattern.comparablePath))
guard let enumerator = FileManager.default.enumerator(
@@ -269,7 +306,9 @@ public enum CloudStorage {
let isMissing =
(error as NSError).domain == NSCocoaErrorDomain
&& (error as NSError).code == NSFileReadNoSuchFileError
- if PathPattern.comparablePath(of: url) == rootPath, !isMissing { collector.unreadable() }
+ if PathPattern.comparablePath(of: url) == rootPath, !isMissing {
+ if let folder { collector.unreadable(folder) } else { collector.unreadable() }
+ }
return true
}
) else {
@@ -277,24 +316,23 @@ public enum CloudStorage {
return
}
- // The budget is spent, or the page that asked was left or stopped.
- func stopped() -> Bool { ContinuousClock.now >= deadline || isGivenUp() }
func key(_ url: URL) -> String {
let path = url.path(percentEncoded: false)
return path.count > 1 && path.hasSuffix("/") ? String(path.dropLast()) : path
}
- var container = ""
- var isICloudDrive = false
+ var container = folder == nil ? "" : containerName(of: cloud.appending(path: "com~apple~CloudDocs"), under: cloud)
+ var isICloudDrive = folder != nil
// The folders Keep Downloaded is on for, itself or through a folder above.
var pinnedFolders: Set<String> = []
+ let isAllPinned = folder.map(isPinned) == true
for case let url as URL in enumerator {
- guard !stopped() else {
+ guard !isGivenUp() else {
collector.ranOutOfTime()
return
}
scan?.add(1)
// Each folder directly in Mobile Documents is one container, named once for everything inside it.
- if enumerator.level == 1 {
+ if folder == nil, enumerator.level == 1 {
container = containerName(of: url, under: root)
isICloudDrive = url.lastPathComponent == "com~apple~CloudDocs"
}
@@ -309,7 +347,7 @@ public enum CloudStorage {
continue
}
guard let values = try? url.resourceValues(forKeys: keys) else { continue }
- let isInAPinnedFolder = pinnedFolders.contains(key(url.deletingLastPathComponent()))
+ let isInAPinnedFolder = isAllPinned || pinnedFolders.contains(key(url.deletingLastPathComponent()))
guard values.isRegularFile == true || values.isPackage == true else {
if isInAPinnedFolder || isPinned(url) { pinnedFolders.insert(key(url)) }
continue
@@ -320,9 +358,9 @@ public enum CloudStorage {
size: ReclaimableSpace.of(url), taken: ReclaimableSpace.allocated(url),
modified: values.contentModificationDate
)
- : package(url, values, exclusions: exclusions, countingFor: scan, unless: stopped)
+ : package(url, values, exclusions: exclusions, countingFor: scan, unless: isGivenUp)
guard let measured else {
- if stopped() {
+ if isGivenUp() {
collector.ranOutOfTime()
return
}
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/CloudStorageTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/CloudStorageTests.swift
index f0d09059..8873620a 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/CloudStorageTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/CloudStorageTests.swift
@@ -70,7 +70,7 @@ struct CloudStorageTests {
let url = try directory.file("Library/Mobile Documents/com~apple~CloudDocs/file.bin", bytes: 2_000_000)
let collector = CloudStorage.Collector()
CloudStorage.collect(
- home: directory.url, minimumSize: 1, exclusions: .none, into: collector, deadline: .now + .seconds(20),
+ home: directory.url, minimumSize: 1, exclusions: .none, into: collector,
countingFor: nil, isSafe: { _ in true }, unless: { false }
)
let scanned = try #require(collector.collected.files.first)
@@ -180,7 +180,6 @@ struct CloudStorageTests {
minimumSize: 1,
exclusions: .none,
into: collector,
- deadline: .now + .seconds(20),
countingFor: nil,
isSafe: { _ in true },
unless: { false }
@@ -205,7 +204,7 @@ struct CloudStorageTests {
let collector = CloudStorage.Collector()
CloudStorage.collect(
- home: directory.url, minimumSize: 1, exclusions: .none, into: collector, deadline: .now + .seconds(20),
+ home: directory.url, minimumSize: 1, exclusions: .none, into: collector,
countingFor: nil, isSafe: { _ in true }, isPinned: { pinned.contains($0.lastPathComponent) },
unless: { false }
)
@@ -225,7 +224,7 @@ struct CloudStorageTests {
let collector = CloudStorage.Collector()
CloudStorage.collect(
- home: directory.url, minimumSize: 1, exclusions: .none, into: collector, deadline: .now + .seconds(20),
+ home: directory.url, minimumSize: 1, exclusions: .none, into: collector,
countingFor: nil, isSafe: { _ in true }, isPinned: { _ in false }, unless: { false }
)
@@ -243,7 +242,7 @@ struct CloudStorageTests {
let collector = CloudStorage.Collector()
CloudStorage.collect(
- home: directory.url, minimumSize: 1, exclusions: .none, into: collector, deadline: .now + .seconds(20),
+ home: directory.url, minimumSize: 1, exclusions: .none, into: collector,
countingFor: nil, isSafe: { _ in true }, isPinned: { _ in false }, unless: { false }
)
@@ -279,7 +278,6 @@ struct CloudStorageTests {
minimumSize: 1,
exclusions: .none,
into: collector,
- deadline: .now + .seconds(20),
countingFor: nil,
isSafe: { _ in true },
isDataless: { PathPattern.comparablePath(of: $0) == evicted },
@@ -307,7 +305,7 @@ struct CloudStorageTests {
let collector = CloudStorage.Collector()
CloudStorage.collect(
home: directory.url, minimumSize: CloudStorage.minimumSize, exclusions: .none, into: collector,
- deadline: .now + .seconds(20), countingFor: nil, isSafe: { _ in true }, unless: { false }
+ countingFor: nil, isSafe: { _ in true }, unless: { false }
)
#expect(collector.collected.files.map(\.name) == ["plain.bin"])
@@ -363,7 +361,17 @@ struct CloudStorageTests {
try directory.file("Library/Mobile Documents/com~apple~CloudDocs/folder\(index)/file.bin", bytes: 1_000)
}
- let scan = await CloudStorage.downloaded(home: directory.url, within: 0)
+ let held = DispatchSemaphore(value: 0)
+ defer { held.signal() }
+
+ let scan = await CloudStorage.downloaded(
+ home: directory.url, minimumSize: 1, exclusions: .none, desktopPictures: [], within: 0,
+ isDataless: { _ in
+ held.wait()
+ held.signal()
+ return false
+ }
+ )
#expect(scan.cutShort == .ranOutOfTime)
}
@@ -377,7 +385,7 @@ struct CloudStorageTests {
let collector = CloudStorage.Collector(maximum: 2)
CloudStorage.collect(
- home: directory.url, minimumSize: 1, exclusions: .none, into: collector, deadline: .now + .seconds(20),
+ home: directory.url, minimumSize: 1, exclusions: .none, into: collector,
countingFor: nil, isSafe: { _ in true }, unless: { false }
)
@@ -403,30 +411,165 @@ struct CloudStorageTests {
#expect(collector.collected.cutShort == .ranOutOfTime)
}
- /// A walk past its deadline stops on its own, without waiting for the timer that gives up on it. That timer
- /// runs on another thread and can fire late on a busy Mac, so a short walk could finish first and read as a
- /// complete list.
- @Test func aWalkPastItsDeadlineStopsWithoutWaitingForTheTimer() async throws {
+ private func linkInICloudDrive(
+ _ name: String, to destination: String, in directory: borrowing TemporaryDirectory
+ ) throws {
+ let drive = try directory.directory("Library/Mobile Documents/com~apple~CloudDocs")
+ try FileManager.default.createSymbolicLink(
+ atPath: drive.appending(path: name).path(percentEncoded: false), withDestinationPath: destination
+ )
+ }
+
+ private func safeScan(of directory: borrowing TemporaryDirectory) async -> CloudScan {
+ await CloudStorage.downloaded(
+ home: directory.url, minimumSize: 1, exclusions: .none, desktopPictures: [], within: CloudStorage.budget,
+ isSafe: { _ in true }, isDataless: { _ in false }
+ )
+ }
+
+ @Test func readsDesktopAndDocumentsWhereICloudDriveKeepsThem() async throws {
let directory = try TemporaryDirectory()
- for index in 0..<3 {
- try directory.file("Library/Mobile Documents/com~apple~CloudDocs/file\(index).bin", bytes: 1_000)
- }
+ try directory.file("Documents/pfp/Me.png", bytes: 2_000)
+ try directory.file("Desktop/Shot.png", bytes: 3_000)
+ try linkInICloudDrive("Documents", to: "../../../Documents", in: directory)
+ try linkInICloudDrive(
+ "Desktop", to: directory.url.appending(path: "Desktop").path(percentEncoded: false), in: directory
+ )
+
+ let scan = await safeScan(of: directory)
+
+ #expect(scan.files.map(\.name) == ["Shot.png", "Me.png"])
+ #expect(scan.files.allSatisfy { $0.isRecommended })
+ #expect(scan.cutShort == nil)
+ #expect(!scan.couldNotRead)
+ #expect(scan.folders.map(\.names) == [["iCloud Drive", "Desktop"], ["iCloud Drive", "Documents", "pfp"]])
+ }
+
+ @Test func leavesAHomeFolderICloudDriveDoesNotKeep() async throws {
+ let directory = try TemporaryDirectory()
+ try directory.file("Documents/Local.png", bytes: 2_000)
+ try directory.file("Desktop/Local.png", bytes: 2_000)
+ try directory.file("Elsewhere/Other.png", bytes: 2_000)
+ try directory.file("Library/Mobile Documents/com~apple~CloudDocs/Documents/InICloud.png", bytes: 2_000)
+ try linkInICloudDrive("Desktop", to: "../../../Elsewhere", in: directory)
+
+ let scan = await safeScan(of: directory)
+
+ #expect(scan.files.map(\.name) == ["InICloud.png"])
+ }
+
+ @Test func aHomeFolderICloudDriveKeepsFollowsTheRulesOfTheRest() async throws {
+ let directory = try TemporaryDirectory()
+ let kept = try directory.file("Documents/Pinned/Kept.png", bytes: 2_000)
+ let secret = try directory.file("Documents/Vault.kdbx", bytes: 2_000)
+ try directory.file("Documents/Excluded/Left.png", bytes: 2_000)
let collector = CloudStorage.Collector()
CloudStorage.collect(
- home: directory.url,
- minimumSize: 1,
- exclusions: .none,
- into: collector,
- deadline: .now,
- countingFor: nil,
- unless: { false }
+ home: directory.url, minimumSize: 1,
+ exclusions: Exclusions(paths: [directory.url.appending(path: "Documents/Excluded")]),
+ keptInTheHome: directory.url.appending(path: "Documents", directoryHint: .isDirectory),
+ into: collector, countingFor: nil, isSafe: { _ in true },
+ isPinned: { $0.lastPathComponent == "Pinned" }, unless: { false }
)
- #expect(collector.collected.cutShort == .ranOutOfTime)
+ let found = Dictionary(uniqueKeysWithValues: collector.collected.files.map { ($0.name, $0) })
+ #expect(Set(found.keys) == [kept.lastPathComponent, secret.lastPathComponent])
+ #expect(found["Kept.png"]?.heldBack == .keptDownloaded)
+ #expect(found["Vault.kdbx"]?.heldBack == .opensOnlyOnline)
+ #expect(found["Kept.png"]?.container == "iCloud Drive")
+ }
+
+ @Test func aHomeFolderKeptDownloadedWholeHoldsBackWhatIsInIt() throws {
+ let directory = try TemporaryDirectory()
+ try directory.file("Documents/File.png", bytes: 2_000)
+ let collector = CloudStorage.Collector()
+
+ CloudStorage.collect(
+ home: directory.url, minimumSize: 1, exclusions: .none,
+ keptInTheHome: directory.url.appending(path: "Documents", directoryHint: .isDirectory),
+ into: collector, countingFor: nil, isSafe: { _ in true },
+ isPinned: { $0.lastPathComponent == "Documents" }, unless: { false }
+ )
+
+ #expect(collector.collected.files.first?.heldBack == .keptDownloaded)
+ }
+
+ @Test func aHomeFolderThatIsExcludedIsNotRead() throws {
+ let directory = try TemporaryDirectory()
+ let documents = directory.url.appending(path: "Documents", directoryHint: .isDirectory)
+ try directory.file("Documents/File.png", bytes: 2_000)
+ let collector = CloudStorage.Collector()
+ let count = ScanCount()
+
+ CloudStorage.collect(
+ home: directory.url, minimumSize: 1, exclusions: Exclusions(paths: [documents]),
+ keptInTheHome: documents, into: collector, countingFor: count, isSafe: { _ in true }, unless: { false }
+ )
+
+ #expect(count.value == 0)
#expect(collector.collected.files.isEmpty)
}
+ @Test func aHomeFolderThatCannotBeReadIsNamedAndTheRestStays() async throws {
+ let directory = try TemporaryDirectory()
+ let documents = try directory.directory("Documents")
+ try directory.file("Library/Mobile Documents/com~apple~CloudDocs/InICloud.png", bytes: 2_000)
+ try linkInICloudDrive("Documents", to: "../../../Documents", in: directory)
+ let path = documents.path(percentEncoded: false)
+ try FileManager.default.setAttributes([.posixPermissions: 0], ofItemAtPath: path)
+ defer { try? FileManager.default.setAttributes([.posixPermissions: 0o755], ofItemAtPath: path) }
+
+ let scan = await safeScan(of: directory)
+
+ #expect(scan.files.map(\.name) == ["InICloud.png"])
+ #expect(!scan.couldNotRead)
+ #expect(scan.unreadableFolders == ["Documents"])
+ }
+
+ @Test func aWalkThatRunsOutOfTimeCostsTheOtherWalksNothing() async throws {
+ let directory = try TemporaryDirectory()
+ try directory.file("Library/Mobile Documents/com~apple~CloudDocs/Stalls/File.png", bytes: 2_000)
+ try directory.file("Documents/Found.png", bytes: 2_000)
+ try linkInICloudDrive("Documents", to: "../../../Documents", in: directory)
+ let held = DispatchSemaphore(value: 0)
+ defer { held.signal() }
+
+ let scan = await CloudStorage.downloaded(
+ home: directory.url, minimumSize: 1, exclusions: .none, desktopPictures: [], within: 0.2,
+ while: { false }, isSafe: { _ in true },
+ isDataless: { url in
+ if url.lastPathComponent == "Stalls" {
+ held.wait()
+ held.signal()
+ }
+ return false
+ }
+ )
+
+ #expect(scan.files.map(\.name) == ["Found.png"])
+ #expect(scan.cutShort == .ranOutOfTime)
+ }
+
+ @Test func aWalkGoesOnPastItsBudgetWhileMacOSAsks() async throws {
+ let directory = try TemporaryDirectory()
+ for index in 0..<3 {
+ try directory.file("Library/Mobile Documents/com~apple~CloudDocs/file\(index).bin", bytes: 2_000)
+ }
+
+ let scan = await CloudStorage.downloaded(
+ home: directory.url, minimumSize: 1, exclusions: .none, desktopPictures: [], within: 0.05,
+ while: { true }, isSafe: { _ in true },
+ isDataless: { _ in
+ Thread.sleep(forTimeInterval: 0.1)
+ return false
+ }
+ )
+
+ #expect(scan.files.count == 3)
+ #expect(scan.cutShort == nil)
+ }
+
@Test func aStoppedScanReturnsWhileItsWalkIsHeld() async throws {
let directory = try TemporaryDirectory()
try directory.file("Library/Mobile Documents/com~apple~CloudDocs/file.bin", bytes: 1_000)
@@ -468,7 +611,7 @@ struct CloudStorageTests {
var isGivenUp = false
CloudStorage.collect(
- home: directory.url, minimumSize: 1, exclusions: .none, into: collector, deadline: .now + .seconds(20),
+ home: directory.url, minimumSize: 1, exclusions: .none, into: collector,
countingFor: nil, isSafe: { _ in true },
isDataless: { _ in
asked += 1
@@ -494,7 +637,7 @@ struct CloudStorageTests {
CloudStorage.collect(
home: directory.url, minimumSize: 1, exclusions: .none, into: collector,
- deadline: .now + .seconds(20), countingFor: nil, isSafe: { _ in true }, unless: { false }
+ countingFor: nil, isSafe: { _ in true }, unless: { false }
)
#expect(collector.collected.files.map(\.name).sorted() == ["Note.bin", "Shared.bin", "Song.mp3"])
@@ -511,7 +654,7 @@ struct CloudStorageTests {
CloudStorage.collect(
home: directory.url, minimumSize: 1, exclusions: .none, into: collector,
- deadline: .now + .seconds(20), countingFor: nil, isSafe: { _ in true },
+ countingFor: nil, isSafe: { _ in true },
isDataless: { $0.lastPathComponent == evicted.lastPathComponent }, unless: { false }
)
@@ -525,7 +668,7 @@ struct CloudStorageTests {
let collector = CloudStorage.Collector()
CloudStorage.collect(
- home: directory.url, minimumSize: 1, exclusions: .none, into: collector, deadline: .now + .seconds(20),
+ home: directory.url, minimumSize: 1, exclusions: .none, into: collector,
countingFor: nil, isSafe: { _ in true }, unless: { false }
)
@@ -545,7 +688,7 @@ struct CloudStorageTests {
CloudStorage.collect(
home: directory.url, minimumSize: 1, exclusions: Exclusions(paths: [archive]), into: collector,
- deadline: .now + .seconds(20), countingFor: count, isSafe: { _ in true }, unless: { false }
+ countingFor: count, isSafe: { _ in true }, unless: { false }
)
#expect(collector.collected.files.map(\.name) == ["kept.bin"])
@@ -567,7 +710,7 @@ struct CloudStorageTests {
CloudStorage.collect(
home: directory.url, minimumSize: 1, exclusions: Exclusions(paths: [excluded]), into: collector,
- deadline: .now + .seconds(20), countingFor: nil, isSafe: { _ in true }, unless: { false }
+ countingFor: nil, isSafe: { _ in true }, unless: { false }
)
let files = Dictionary(uniqueKeysWithValues: collector.collected.files.map { ($0.name, $0) })
@@ -584,7 +727,7 @@ struct CloudStorageTests {
let inside = try directory.file("\(drive)/Notes.rtfd/TXT.rtf", bytes: 2_000_000)
let collector = CloudStorage.Collector()
CloudStorage.collect(
- home: directory.url, minimumSize: 1, exclusions: .none, into: collector, deadline: .now + .seconds(20),
+ home: directory.url, minimumSize: 1, exclusions: .none, into: collector,
countingFor: nil, isSafe: { _ in true }, unless: { false }
)
let scanned = try #require(collector.collected.files.first)
@@ -604,7 +747,7 @@ struct CloudStorageTests {
let inside = try directory.file("\(drive)/Notes.rtfd/TXT.rtf", bytes: 2_000_000)
let collector = CloudStorage.Collector()
CloudStorage.collect(
- home: directory.url, minimumSize: 1, exclusions: .none, into: collector, deadline: .now + .seconds(20),
+ home: directory.url, minimumSize: 1, exclusions: .none, into: collector,
countingFor: nil, isSafe: { _ in true }, unless: { false }
)
let scanned = try #require(collector.collected.files.first)
@@ -684,7 +827,7 @@ struct CloudStorageTests {
let collector = CloudStorage.Collector()
CloudStorage.collect(
home: directory.url, minimumSize: 1, exclusions: .none, desktopPictures: [picture], into: collector,
- deadline: .now + .seconds(20), countingFor: nil, isSafe: { _ in true }, unless: { false }
+ countingFor: nil, isSafe: { _ in true }, unless: { false }
)
let marked = Dictionary(uniqueKeysWithValues: collector.collected.files.map { ($0.name, $0.isDesktopPicture) })
diff --git a/Peel/Model/CloudLibrary.swift b/Peel/Model/CloudLibrary.swift
index 2bd372eb..8eba366a 100644
--- a/Peel/Model/CloudLibrary.swift
+++ b/Peel/Model/CloudLibrary.swift
@@ -34,6 +34,8 @@ final class CloudLibrary {
/// The downloads left out because another copy on this Mac shares their space, so removing them frees nothing.
private(set) var sharedDownloads = 0
private(set) var isNotSetUp = false
+ /// The folders of the home iCloud Drive keeps that macOS would not let Peel read.
+ private(set) var unreadableFolders: [String] = []
var selectedURLs: Set<URL> = [] {
didSet { updateSelectedSize() }
}
@@ -60,7 +62,7 @@ final class CloudLibrary {
/// nil until iCloud Drive has been read.
var total: SizeTotal? {
guard let files, !couldNotRead else { return nil }
- return SizeTotal(known: files.map(\.size).cappedSum, isComplete: cutShort == nil)
+ return SizeTotal(known: files.map(\.size).cappedSum, isComplete: cutShort == nil && unreadableFolders.isEmpty)
}
/// The files whose folder or path holds `query`, every file for an empty one.
@@ -100,6 +102,7 @@ final class CloudLibrary {
couldNotRead = found.couldNotRead
sharedDownloads = found.sharedDownloads
isNotSetUp = found.isNotSetUp
+ unreadableFolders = found.unreadableFolders
selectedURLs.formIntersection(Set(found.files.map(\.url)))
}
diff --git a/Peel/Views/Cloud/CloudView.swift b/Peel/Views/Cloud/CloudView.swift
index 8654c10b..2e89952f 100644
--- a/Peel/Views/Cloud/CloudView.swift
+++ b/Peel/Views/Cloud/CloudView.swift
@@ -102,7 +102,7 @@ struct CloudView: View {
)
}
} footer: {
- if cloud.cutShort != nil || cloud.sharedDownloads > 0 {
+ if cloud.cutShort != nil || cloud.sharedDownloads > 0 || !cloud.unreadableFolders.isEmpty {
VStack(alignment: .leading, spacing: 6) {
switch cloud.cutShort {
case .listIsFull:
@@ -112,6 +112,7 @@ struct CloudView: View {
case nil:
EmptyView()
}
+ unreadableFoldersNote
sharedDownloadsNote
}
.font(.callout)
@@ -135,13 +136,16 @@ struct CloudView: View {
} actions: {
Button("Open System Settings") { home.openFullDiskAccessSettings() }
}
- } else if cloud.files?.isEmpty == true, cloud.cutShort != nil {
+ } else if cloud.files?.isEmpty == true, hasMoreThanItRead {
// The scan stopped early, so an empty list does not mean there is nothing to free.
ContentUnavailableView {
Label("Nothing Found So Far", systemImage: "icloud")
} description: {
VStack(spacing: 8) {
- Text("There is more in iCloud Drive than Peel can read in the time it gives a scan, and nothing in the part it read is big enough to be worth freeing.")
+ if cloud.cutShort != nil {
+ Text("There is more in iCloud Drive than Peel can read in the time it gives a scan, and nothing in the part it read is big enough to be worth freeing.")
+ }
+ unreadableFoldersNote
sharedDownloadsNote
}
}
@@ -231,6 +235,16 @@ struct CloudView: View {
}
}
+ private var hasMoreThanItRead: Bool {
+ cloud.cutShort != nil || !cloud.unreadableFolders.isEmpty
+ }
+
+ @ViewBuilder private var unreadableFoldersNote: some View {
+ if !cloud.unreadableFolders.isEmpty {
+ Text("macOS didn’t let Peel read \(cloud.unreadableFolders.formatted(.list(type: .and))) in iCloud Drive, so this list isn’t all of it. Full Disk Access in System Settings gives Peel what it needs.")
+ }
+ }
+
@ViewBuilder private var sharedDownloadsNote: some View {
if cloud.sharedDownloads > 0 {
Text("Peel doesn’t list ^[\(cloud.sharedDownloads) download](inflect: true) whose space on disk is shared with a copy iCloud keeps on this Mac once it has uploaded the file, or with another copy: removing a download like that frees nothing now.")
@@ -264,7 +278,7 @@ struct CloudView: View {
private var couldNotLook: LocalizedStringResource? {
if cloud.couldNotRead { return "iCloud Drive Couldn’t Be Read" }
- if cloud.files?.isEmpty == true, cloud.cutShort != nil { return "Nothing Found So Far" }
+ if cloud.files?.isEmpty == true, hasMoreThanItRead { return "Nothing Found So Far" }
return nil
}
diff --git a/PeelTests/CloudLibraryTests.swift b/PeelTests/CloudLibraryTests.swift
index 995e4904..c9d5ff48 100644
--- a/PeelTests/CloudLibraryTests.swift
+++ b/PeelTests/CloudLibraryTests.swift
@@ -17,6 +17,17 @@ struct CloudLibraryTests {
)
}
+ @Test func aFolderOfTheHomeThatCouldNotBeReadLeavesTheTotalOnlyTheLeastItCanBe() async {
+ let cloud = CloudLibrary(scan: { _, _, _ in
+ CloudScan(files: [Self.download("Plan.pdf")], unreadableFolders: ["Documents"])
+ })
+
+ await cloud.refresh()
+
+ #expect(cloud.unreadableFolders == ["Documents"])
+ #expect(cloud.total?.isComplete == false)
+ }
+
@Test func hasNoTotalUntilICloudDriveIsRead() async throws {
let home = FileManager.default.temporaryDirectory.appending(path: "PeelTests-\(UUID().uuidString)")
let drive = home.appending(path: "Library/Mobile Documents", directoryHint: .isDirectory)
diff --git a/Support/Peel-Info.plist b/Support/Peel-Info.plist
index 2fd0f51d..078c72e7 100644
--- a/Support/Peel-Info.plist
+++ b/Support/Peel-Info.plist
@@ -5,9 +5,9 @@
<key>NSAppDataUsageDescription</key>
<string>Peel looks inside an app’s own container to list what it would leave behind. Nothing is removed until you say so.</string>
<key>NSDesktopFolderUsageDescription</key>
- <string>Peel looks here for installers and duplicate files. Nothing is removed until you say so.</string>
+ <string>Peel looks here for installers and duplicate files, and for iCloud downloads it can remove when this folder is in iCloud Drive. Nothing is removed until you say so.</string>
<key>NSDocumentsFolderUsageDescription</key>
- <string>Peel looks here for installers, duplicate files, and what builds left behind. Nothing is removed until you say so.</string>
+ <string>Peel looks here for installers, duplicate files, and what builds left behind, and for iCloud downloads it can remove when this folder is in iCloud Drive. Nothing is removed until you say so.</string>
<key>NSDownloadsFolderUsageDescription</key>
<string>Peel looks here for installers and duplicate files. Nothing is removed until you say so.</string>
<key>NSFileProviderDomainUsageDescription</key>