Free, open-source macOS cleaner. CleanMyMac alternative with zero telemetry. Native SwiftUI, scheduled auto-cleaning, Xcode/Homebrew/system cache cleanup. MIT licensed.
Swift cache-cleanercleanmymaccleanupdisk-cleanerdisk-spacehomebrewmac-utilitymacosmacos-appmacos-cleanermacosxnativeossosxprivacyswiftswiftuisystem-cleanerxcode-cleaner
fix: stop showing root "/" as purgeable-space target (#112)
Luca Bandini2c959216858c
diff --git a/PureMac/Services/CleaningEngine.swift b/PureMac/Services/CleaningEngine.swiftindex bc70e22..5dc3c1b 100644--- a/PureMac/Services/CleaningEngine.swift+++ b/PureMac/Services/CleaningEngine.swift@@ -28,6 +28,11 @@ actor CleaningEngine {let purged = await purgePurgeableSpace()result.freedSpace += purgedif purged > 0 { result.itemsCleaned += 1 }+ // Purgeable space is a one-shot reclaim action, not a file+ // unlink. Mark it handled so it isn't later mistaken for an+ // item that "couldn't be removed" (the purge ran regardless of+ // how much APFS chose to release). See issue #112.+ result.cleanedPaths.insert(item.path)continue}diff --git a/PureMac/Services/ScanEngine.swift b/PureMac/Services/ScanEngine.swiftindex c7279a6..81d2249 100644--- a/PureMac/Services/ScanEngine.swift+++ b/PureMac/Services/ScanEngine.swift@@ -286,9 +286,16 @@ actor ScanEngine {// Detect APFS purgeable space via URLResourceValues (no admin needed)let diskInfo = getDiskInfo()if diskInfo.purgeableSpace > 0 {+ // Purgeable space is reclaimed via `diskutil apfs purgePurgeable /`+ // (see CleaningEngine.purgePurgeableSpace), it is NOT a file that+ // gets unlinked. Using "/" as the path made the UI render the root+ // directory as the deletion target and triggered a bogus+ // "couldn't remove /" error after cleaning. Use an empty path so+ // the row shows no misleading filesystem location and the reveal-+ // in-Finder action stays disabled for this entry. (See issue #112.)items.append(CleanableItem(name: "APFS Purgeable Space",- path: "/",+ path: "",size: diskInfo.purgeableSpace,category: .purgeableSpace,isSelected: true,diff --git a/PureMac/Views/CategoryDetailView.swift b/PureMac/Views/CategoryDetailView.swiftindex 9ada946..77b2959 100644--- a/PureMac/Views/CategoryDetailView.swift+++ b/PureMac/Views/CategoryDetailView.swift@@ -214,11 +214,13 @@ private struct FileRowView: View {.lineLimit(1).truncationMode(.middle)- Text(item.path)- .font(.caption)- .foregroundStyle(.tertiary)- .lineLimit(1)- .truncationMode(.middle)+ if !item.path.isEmpty {+ Text(item.path)+ .font(.caption)+ .foregroundStyle(.tertiary)+ .lineLimit(1)+ .truncationMode(.middle)+ }}Spacer()@@ -237,8 +239,10 @@ private struct FileRowView: View {}.toggleStyle(.checkbox).contextMenu {- Button("Reveal in Finder") {- NSWorkspace.shared.selectFile(item.path, inFileViewerRootedAtPath: "")+ if !item.path.isEmpty {+ Button("Reveal in Finder") {+ NSWorkspace.shared.selectFile(item.path, inFileViewerRootedAtPath: "")+ }}}}