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
List in iCloud Drive only what Finder shows
Țugui Dragoșc4f4abfb79dd
diff --git a/GUIDE.md b/GUIDE.mdindex d470a660..f25f843f 100644--- a/GUIDE.md+++ b/GUIDE.md@@ -70,10 +70,10 @@ Space shows what fills your disk, area by area, and what each area is.iPad backups are listed with their size, and never moved. Nothing is selected for you, and Select Recommendedtakes only what you can download again: an installed app's installer, or one in Downloads, never an encrypted diskimage. A disk image can also be one you made to keep files in, so look before you select it.-- **iCloud Drive:** files already safe in iCloud that are also downloaded to this Mac. 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- 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.+- **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. 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 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.- **Space:** what's taking up room, and which app it belongs to. What an app manages itself, such as Docker's disk,Space leaves to that app, with the command that frees it, when there is one, for you to copy.- **File Search:** large or old files, found through Spotlight.diff --git a/Packages/PeelCore/Sources/PeelCore/Space/CloudStorage.swift b/Packages/PeelCore/Sources/PeelCore/Space/CloudStorage.swiftindex 4b45602b..cd3ba245 100644--- a/Packages/PeelCore/Sources/PeelCore/Space/CloudStorage.swift+++ b/Packages/PeelCore/Sources/PeelCore/Space/CloudStorage.swift@@ -239,6 +239,7 @@ public enum CloudStorage {// The budget is spent, or the page that asked was left or stopped.func stopped() -> Bool { ContinuousClock.now >= deadline || isGivenUp() }var container = ""+ var isICloudDrive = falsefor case let url as URL in enumerator {guard !stopped() else {collector.cutShort()@@ -246,8 +247,14 @@ public enum CloudStorage {}scan?.add(1)// Each folder directly in Mobile Documents is one container, named once for everything inside it.- if enumerator.level == 1 { container = containerName(of: url, under: root) }- if isDataless(url) {+ if enumerator.level == 1 {+ container = containerName(of: url, under: root)+ isICloudDrive = url.lastPathComponent == "com~apple~CloudDocs"+ }+ // Of an app's container Finder shows only `Documents`; the rest is the app's own data.+ let isAppsOwnData = enumerator.level == 2 && !isICloudDrive+ && url.lastPathComponent.caseInsensitiveCompare("Documents") != .orderedSame+ if isAppsOwnData || isDataless(url) {// After a file, `skipDescendants()` would skip the next folder's contents instead.if (try? url.resourceValues(forKeys: [.isDirectoryKey]))?.isDirectory == true {enumerator.skipDescendants()diff --git a/Packages/PeelCore/Tests/PeelCoreTests/CloudStorageTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/CloudStorageTests.swiftindex 469d133f..573c3308 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/CloudStorageTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/CloudStorageTests.swift@@ -301,6 +301,25 @@ struct CloudStorageTests {#expect(collector.collected.files.isEmpty)}+ /// In an app's iCloud folder only `Documents` is what Finder shows; the rest is the app's own data.+ @Test func listsOnlyWhatFinderShows() throws {+ let directory = try TemporaryDirectory()+ let cloud = "Library/Mobile Documents"+ try directory.file("\(cloud)/com~apple~CloudDocs/Song.mp3", bytes: 2_000_000)+ try directory.file("\(cloud)/com~apple~CloudDocs/Data/Shared.bin", bytes: 2_000_000)+ try directory.file("\(cloud)/iCloud~org~example~notes/Documents/Note.bin", bytes: 2_000_000)+ try directory.file("\(cloud)/iCloud~org~example~notes/Data/cache.bin", bytes: 2_000_000)+ try directory.file("\(cloud)/iCloud~org~example~notes/state.bin", bytes: 2_000_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 }, unless: { false }+ )++ #expect(collector.collected.files.map(\.name).sorted() == ["Note.bin", "Shared.bin", "Song.mp3"])+ }+/// A file whose download was removed holds nothing here, and the folder after it is still looked into.@Test func looksIntoTheFolderAfterAFileWhoseDownloadWasRemoved() throws {let directory = try TemporaryDirectory()