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.

Recommend only what is in iCloud Drive itself

Țugui Dragoș7b4e8dc5d21e
diff --git a/GUIDE.md b/GUIDE.md
index 1dd4e014..c99c2926 100644
--- a/GUIDE.md
+++ b/GUIDE.md
@@ -139,13 +139,14 @@ 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. 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 the
- copy on this Mac: each file stays in iCloud and downloads again when you open it. A file Keep Downloaded is on for
- in Finder is listed and not selected, since iCloud would download it again at once. A download whose space on disk
- is shared with another copy on this Mac would free nothing, so it isn't listed, and the page says how many there
- are. The page needs Full Disk Access to see what is kept on this Mac.
+ in iCloud Drive 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
+ the copy on this Mac: each file stays in iCloud and downloads again when you open it. A file Keep Downloaded is on
+ for in Finder is listed and not selected, since iCloud would download it again at once. A download whose space on
+ disk is shared with another copy on this Mac would free nothing, so it isn't listed, and the page says how many
+ there are. The page needs Full Disk Access to see what is kept on this Mac.
- **Space:** what fills your disk, area by area, and which app or tool each area belongs to.
- **File Search:** files by name, kind, or size, and by age along with one of them, in your home folder or across this
Mac's disks, not network volumes, found through Spotlight, up to 2,000 at a time, so a folder in System Settings >
diff --git a/Localization/Peel/Localizable.xcstrings b/Localization/Peel/Localizable.xcstrings
index a7a65727..294295f5 100644
--- a/Localization/Peel/Localizable.xcstrings
+++ b/Localization/Peel/Localizable.xcstrings
@@ -102777,6 +102777,113 @@
}
}
},
+ "Not selected: it is in an app’s own iCloud folder, which Finder may not show, and the app may expect to find it on this Mac." : {
+ "comment" : "The note beside a file in iCloud Drive that sits in an app's own folder in iCloud, such as the Documents folder of an app's iCloud container, rather than in iCloud Drive itself.",
+ "localizations" : {
+ "cs" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Nevybráno: je ve vlastní složce aplikace na iCloudu, kterou Finder nemusí zobrazovat, a aplikace může počítat s tím, že ho najde v tomto Macu."
+ }
+ },
+ "de" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Nicht ausgewählt: Diese Datei liegt im eigenen iCloud-Ordner einer App, den der Finder möglicherweise nicht anzeigt, und die App erwartet möglicherweise, sie auf diesem Mac vorzufinden."
+ }
+ },
+ "es" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Sin seleccionar: está en la propia carpeta de iCloud de una app, que quizá el Finder no muestre, y puede que la app espere encontrarlo en este Mac."
+ }
+ },
+ "fr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Non sélectionné : ce fichier se trouve dans le dossier iCloud propre à une app, que le Finder n’affiche peut-être pas, et l’app peut s’attendre à le trouver sur ce Mac."
+ }
+ },
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Non selezionato: si trova nella cartella iCloud di un’app, che il Finder potrebbe non mostrare, e l’app potrebbe aspettarsi di trovarlo su questo Mac."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "未選択: アプリ専用のiCloudフォルダにあります。このフォルダはFinderに表示されないことがあり、アプリはこのファイルがこのMac上にあるものと想定している可能性があります。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "선택되지 않음: 이 파일은 Finder에 표시되지 않을 수 있는 앱 전용 iCloud 폴더에 있으며, 앱은 이 파일이 이 Mac에 있을 것으로 예상할 수 있습니다."
+ }
+ },
+ "nl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Niet geselecteerd: dit staat in de eigen iCloud-map van een app, die Finder misschien niet toont, en de app verwacht het misschien op deze Mac te vinden."
+ }
+ },
+ "pl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Nie zaznaczono: ten plik jest we własnym folderze aplikacji w iCloud, którego Finder może nie pokazywać, a aplikacja może oczekiwać, że znajdzie go na tym Macu."
+ }
+ },
+ "pt" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Não selecionado: ele está na pasta própria de um app no iCloud, que o Finder talvez não mostre, e o app pode esperar encontrá-lo neste Mac."
+ }
+ },
+ "ro" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Neselectat: acest fișier se află în dosarul iCloud propriu al unei aplicații, pe care Finder s‑ar putea să nu îl afișeze, iar aplicația se poate aștepta să găsească fișierul pe acest Mac."
+ }
+ },
+ "ru" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Не выбрано: этот файл находится в собственной папке приложения в iCloud, которую Finder может не показывать, и приложение может рассчитывать найти его на этом Mac."
+ }
+ },
+ "sv" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Inte markerad: den ligger i en apps egen iCloud-mapp, som Finder kanske inte visar, och appen kan förvänta sig att hitta den på den här datorn."
+ }
+ },
+ "tr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Seçilmedi: bir uygulamanın kendi iCloud klasöründe bulunuyor; Finder bu klasörü göstermeyebilir ve uygulama bu dosyayı bu Mac’te bulmayı bekleyebilir."
+ }
+ },
+ "uk" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Не вибрано: цей файл міститься у власній папці програми в iCloud, яку Finder може не показувати, і програма може очікувати, що знайде його на цьому Mac."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "未选择:它位于某个App自己的iCloud文件夹中,“访达”可能不会显示该文件夹,而且该App可能会期望在这台Mac上找到它。"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "未選取:它位於App自己的iCloud檔案夾中,Finder可能不會顯示該檔案夾,而且App可能預期在這部Mac上找到它。"
+ }
+ }
+ }
+ },
"Not selected: it is the wallpaper, which macOS keeps open while it is shown, so its download can’t be removed now." : {
"localizations" : {
"cs" : {
diff --git a/Packages/PeelCore/Sources/PeelCommandLine/Support/Output.swift b/Packages/PeelCore/Sources/PeelCommandLine/Support/Output.swift
index f5281962..f82f8028 100644
--- a/Packages/PeelCore/Sources/PeelCommandLine/Support/Output.swift
+++ b/Packages/PeelCore/Sources/PeelCommandLine/Support/Output.swift
@@ -395,6 +395,7 @@ extension HoldBack {
case .inTheCloud: "syncs to your other devices through iCloud or another app, so moving it would remove it from them too"
case .keepsWhatTheOthersLack: "has Finder tags, a comment, or a resource fork the other copies don't"
case .keptDownloaded: "Keep Downloaded is on for it in Finder, so iCloud downloads it again"
+ case .inAnAppsICloudFolder: "in an app's own iCloud folder, which the app may expect to find on this Mac"
case .openInAProgram: "open in a program right now, which may still be using it"
case .attachedDiskImage: "a disk image open right now; eject it first"
case .changedRecently: "changed in the last day, so it may still be downloading"
diff --git a/Packages/PeelCore/Sources/PeelCore/Leftovers/Leftover.swift b/Packages/PeelCore/Sources/PeelCore/Leftovers/Leftover.swift
index 48a2f098..4101a7cb 100644
--- a/Packages/PeelCore/Sources/PeelCore/Leftovers/Leftover.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Leftovers/Leftover.swift
@@ -165,6 +165,9 @@ public enum HoldBack: String, Sendable, Hashable {
/// A download in iCloud Drive that Keep Downloaded keeps on this Mac, which iCloud downloads again once it is
/// removed.
case keptDownloaded
+ /// A download in an app's own folder in iCloud, which Finder may not show and the app may expect to find on
+ /// this Mac.
+ case inAnAppsICloudFolder
/// True when the item cannot be selected at all, rather than only left unselected: the guard or the helper
/// would refuse to move it.
diff --git a/Packages/PeelCore/Sources/PeelCore/Space/CloudStorage.swift b/Packages/PeelCore/Sources/PeelCore/Space/CloudStorage.swift
index d0be1ac0..26d89af2 100644
--- a/Packages/PeelCore/Sources/PeelCore/Space/CloudStorage.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Space/CloudStorage.swift
@@ -338,7 +338,8 @@ public enum CloudStorage {
size: measured.size,
modified: measured.modified,
isDesktopPicture: pictures.contains(PathPattern.comparablePath(of: url)),
- heldBack: isInAPinnedFolder || isPinned(url) ? .keptDownloaded : nil
+ heldBack: isInAPinnedFolder || isPinned(url) ? .keptDownloaded
+ : isICloudDrive ? nil : .inAnAppsICloudFolder
)
collector.add(file)
}
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/CloudStorageTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/CloudStorageTests.swift
index fda20972..2c758d5e 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/CloudStorageTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/CloudStorageTests.swift
@@ -221,6 +221,24 @@ struct CloudStorageTests {
#expect(collector.collected.files.filter(\.isRecommended).map(\.name) == ["a.pdf"])
}
+ /// What an app keeps in its own iCloud folder is listed and not recommended: Finder may not show it, and the app
+ /// may expect to find it on this Mac. Only what is in iCloud Drive itself is.
+ @Test func recommendsOnlyWhatIsInICloudDriveItself() throws {
+ let directory = try TemporaryDirectory()
+ try directory.file("Library/Mobile Documents/com~apple~CloudDocs/Report.pdf", bytes: 2_000)
+ try directory.file("Library/Mobile Documents/iCloud~org~example~notes/Documents/notes.db", bytes: 2_000)
+
+ let collector = CloudStorage.Collector()
+ CloudStorage.collect(
+ home: directory.url, minimumSize: 1, exclusions: .none, into: collector, deadline: .now + .seconds(20),
+ countingFor: nil, isSafe: { _ in true }, isPinned: { _ in false }, unless: { false }
+ )
+
+ let held = Dictionary(uniqueKeysWithValues: collector.collected.files.map { ($0.name, $0.heldBack) })
+ #expect(held["Report.pdf"] == .some(nil))
+ #expect(held["notes.db"] == .inAnAppsICloudFolder)
+ }
+
/// A folder kept only in the cloud, which no test can make, is named to the walk.
@Test func neverLooksIntoAFolderThatLivesOnlyInTheCloud() throws {
let directory = try TemporaryDirectory()
diff --git a/Peel/Views/Presentation.swift b/Peel/Views/Presentation.swift
index 8dc482c5..64c23ade 100644
--- a/Peel/Views/Presentation.swift
+++ b/Peel/Views/Presentation.swift
@@ -410,6 +410,8 @@ extension HoldBack {
"Left alone: this copy has Finder tags, a Finder comment, or a resource fork the others don’t, which moving it would lose."
case .keptDownloaded:
"Not selected: Keep Downloaded is on for it in Finder, so iCloud downloads it again."
+ case .inAnAppsICloudFolder:
+ "Not selected: it is in an app’s own iCloud folder, which Finder may not show, and the app may expect to find it on this Mac."
case .openInAProgram:
"Not selected: a program has this open right now, and may still be using it."
case .attachedDiskImage: