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
Work out each path once in the walk to a maker's folders
Țugui Dragoșa09c4e557fe0
diff --git a/Packages/PeelCore/Sources/PeelCore/Removal/MakersFolders.swift b/Packages/PeelCore/Sources/PeelCore/Removal/MakersFolders.swiftindex 583bfefd..62680998 100644--- a/Packages/PeelCore/Sources/PeelCore/Removal/MakersFolders.swift+++ b/Packages/PeelCore/Sources/PeelCore/Removal/MakersFolders.swift@@ -21,23 +21,23 @@ struct MakersFolders {/// keeps under that name directly in its location (`SystemFolders`).func above(_ moved: [URL]) -> [URL] {let locations = environment.locations- let ends = Set(locations.map { PathPattern.comparablePath(of: $0.url) })- let places = locations.filter { Self.kinds.contains($0.kind) }.map { PathPattern.comparablePath(of: $0.url) }let kindsAt = Dictionary(grouping: locations, by: { PathPattern.comparablePath(of: $0.url) }).mapValues { $0.map(\.kind) }- func isMacOSs(_ folder: URL) -> Bool {- let parent = PathPattern.comparablePath(of: folder.deletingLastPathComponent())- return (kindsAt[parent] ?? []).contains { SystemFolders.keeps(folder.lastPathComponent, in: $0) }- }+ let ends = Set(kindsAt.keys)+ let places = locations.filter { Self.kinds.contains($0.kind) }.map { PathPattern.comparablePath(of: $0.url) }var folders: [String: URL] = [:]for url in moved {var folder = url.deletingLastPathComponent()var path = PathPattern.comparablePath(of: folder)while !ends.contains(path), places.contains(where: { PathComponents.isPath(path, inside: $0) }),- names.contains(Naming.folderName(folder.lastPathComponent)), !isMacOSs(folder) {+ names.contains(Naming.folderName(folder.lastPathComponent)) {+ let parent = folder.deletingLastPathComponent()+ let parentPath = PathPattern.comparablePath(of: parent)+ let name = folder.lastPathComponent+ guard !(kindsAt[parentPath] ?? []).contains(where: { SystemFolders.keeps(name, in: $0) }) else { break }folders[path] = folder- folder = folder.deletingLastPathComponent()- path = PathPattern.comparablePath(of: folder)+ folder = parent+ path = parentPath}}return folders.sorted { PathComponents.of($0.key).count > PathComponents.of($1.key).count }.map(\.value)