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
Walk the folder after a file named like a bundle in the printer folders
Țugui Dragoș320a1847f2ce
diff --git a/Packages/PeelCore/Sources/PeelCore/Apps/IntelInspector.swift b/Packages/PeelCore/Sources/PeelCore/Apps/IntelInspector.swiftindex 8f032516..577af413 100644--- a/Packages/PeelCore/Sources/PeelCore/Apps/IntelInspector.swift+++ b/Packages/PeelCore/Sources/PeelCore/Apps/IntelInspector.swift@@ -305,7 +305,10 @@ public enum IntelInspector {for case let item as URL in enumerator {guard !Task.isCancelled else { break }if driverExtensions.contains(item.pathExtension) {- enumerator.skipDescendants()+ // After a file, `skipDescendants()` would skip the next folder's contents instead.+ if (try? item.resourceValues(forKeys: [.isDirectoryKey]))?.isDirectory == true {+ enumerator.skipDescendants()+ }continue}let values = try? item.resourceValues(forKeys: keys)diff --git a/Packages/PeelCore/Tests/PeelCoreTests/IntelInspectorTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/IntelInspectorTests.swiftindex b2bfa274..3f68a195 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/IntelInspectorTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/IntelInspectorTests.swift@@ -90,6 +90,23 @@ struct IntelInspectorTests {#expect(walked.1.isEmpty)}+ /// A file named like a bundle, as `git bundle` writes one, has nothing inside, and the folder after it is walked.+ @Test func walksTheFolderAfterAFileNamedLikeABundle() throws {+ let directory = try TemporaryDirectory()+ try directory.file("Printers/Backup.bundle", bytes: 16)+ for folder in ["Filters", "Tools", "Utilities", "Scripts", "Helpers"] {+ let filter = try directory.file("Printers/\(folder)/filter", contents: intelHeader(fileType: 2))+ try FileManager.default.setAttributes(+ [.posixPermissions: 0o755], ofItemAtPath: filter.path(percentEncoded: false)+ )+ }+ let printers = directory.url.appending(path: "Printers").path(percentEncoded: false)++ let folders = IntelInspector.programs(in: [printers]).map { $0.deletingLastPathComponent().lastPathComponent }++ #expect(folders.sorted() == ["Filters", "Helpers", "Scripts", "Tools", "Utilities"])+ }+private func bundle(_ directory: borrowing TemporaryDirectory, _ path: String, cpuTypes: [UInt32]) throws -> URL {let name = (path as NSString).lastPathComponentlet executableName = (name as NSString).deletingPathExtension