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
Let History put back a folder Space keeps in place
Țugui Dragoș2c0d7d70ccb6
diff --git a/Packages/PeelCore/Sources/PeelCore/Removal/RemovalGuard.swift b/Packages/PeelCore/Sources/PeelCore/Removal/RemovalGuard.swiftindex 53a0648b..e95eb520 100644--- a/Packages/PeelCore/Sources/PeelCore/Removal/RemovalGuard.swift+++ b/Packages/PeelCore/Sources/PeelCore/Removal/RemovalGuard.swift@@ -150,9 +150,11 @@ struct RemovalGuard: Sendable {guard !ProtectedData.holds(spellings: spellings, home: home) else { return .holdsProtectedData }}+ // A folder that stays itself never moves, though one that is gone may come back as the folder it was.+ let comesBackAsAFolder = item != nil && type == S_IFDIRfor spelling in spelled.values.reduce(into: Set<String>(), { $0.formUnion($1) }) {let isUnderAPrefix = Self.protectedPrefixes.contains { PathComponents.isPath(spelling, inside: $0) }- guard !protectedPaths.contains(spelling) else { return .staysItself }+ guard comesBackAsAFolder || !protectedPaths.contains(spelling) else { return .staysItself }let mayGo = Self.isAToolsLink(spelling, isALink: type == S_IFLNK)|| Self.isACasksRecord(spelling, isAFolder: type == S_IFDIR)guard !isUnderAPrefix || mayGo else { return .protectedLocation }diff --git a/Packages/PeelCore/Tests/PeelCoreTests/SpaceRemovalTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/SpaceRemovalTests.swiftindex 651878d7..138546c3 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/SpaceRemovalTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/SpaceRemovalTests.swift@@ -253,6 +253,18 @@ struct SpaceRemovalTests {#expect(removalGuard.refusal(of: reports) == .staysItself)}+ @Test func putsBackTheAccountsCrashReportsFolderOnlyAsAFolder() throws {+ let directory = try TemporaryDirectory()+ try directory.directory("home/Library/Logs")+ let trashedFolder = try directory.directory("home/.Trash/DiagnosticReports")+ let trashedFile = try directory.file("home/.Trash/report")+ let reports = directory.url.appending(path: "home/Library/Logs/DiagnosticReports", directoryHint: .isDirectory)+ let removalGuard = RemovalGuard(environment: environment(directory), exclusions: .none)++ #expect(removalGuard.allowsPuttingBack(trashedFolder, at: reports))+ #expect(!removalGuard.allowsPuttingBack(trashedFile, at: reports))+ }+@Test(.permissionsHold) func whatOnlyAnAdministratorCanMoveGoesThroughTheHelper() async throws {let directory = try TemporaryDirectory()try directory.file("root/Library/Caches/org.example.updater/data.bin")