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
Build Package Receipts' shared folders from the folders Peel searches
Țugui Dragoș93481292fbde
diff --git a/Packages/PeelCore/Sources/PeelCore/Packages/PackageReceipts.swift b/Packages/PeelCore/Sources/PeelCore/Packages/PackageReceipts.swiftindex dc0a322b..e6bc845d 100644--- a/Packages/PeelCore/Sources/PeelCore/Packages/PackageReceipts.swift+++ b/Packages/PeelCore/Sources/PeelCore/Packages/PackageReceipts.swift@@ -4,19 +4,20 @@ internal import PeelPrivilegedpublic enum PackageReceipts {static let concurrentReceipts = 4- /// Directories many packages install into; they never belong to a single package.- static let sharedDirectories: Set<String> = [- "/", "/Applications", "/Applications/Utilities", "/Library", "/Library/Application Support", "/Library/Audio",- "/Library/Audio/Plug-Ins", "/Library/Audio/Plug-Ins/Components", "/Library/Audio/Plug-Ins/HAL",- "/Library/Audio/Plug-Ins/VST", "/Library/Audio/Plug-Ins/VST3", "/Library/Caches", "/Library/ColorSync",- "/Library/ColorSync/Profiles", "/Library/Extensions", "/Library/Fonts", "/Library/Frameworks",- "/Library/Input Methods", "/Library/Internet Plug-Ins", "/Library/LaunchAgents", "/Library/LaunchDaemons",- "/Library/Logs", "/Library/PreferencePanes", "/Library/Preferences", "/Library/Printers",- "/Library/PrivilegedHelperTools", "/Library/QuickLook", "/Library/Screen Savers", "/Library/Services",- "/Library/Spotlight", "/Library/SystemExtensions", "/System", "/Users", "/Users/Shared", "/etc", "/opt",- "/private", "/private/etc", "/private/tmp", "/private/var", "/tmp", "/usr", "/usr/local", "/usr/local/bin",- "/usr/local/etc", "/usr/local/include", "/usr/local/lib", "/usr/local/libexec", "/usr/local/sbin",- "/usr/local/share", "/usr/local/share/doc", "/usr/local/share/man", "/usr/local/share/man/man1", "/var",+ /// Directories many packages install into; they never belong to a single package. The folders Peel searches in+ /// `/Library` come from `LibraryFolder`, so the two can't drift apart, with every folder on the way to one.+ static let sharedDirectories: Set<String> = {+ let searched = (LibraryFolder.local + LibraryFolder.plugIns).map { "/Library/" + $0.rawValue }+ return Set(searched + searched.flatMap(ProtectedObjects.ancestors(of:))).union(otherSharedDirectories)+ }()++ private static let otherSharedDirectories: Set<String> = [+ "/", "/Applications", "/Applications/Utilities", "/Library/ColorSync", "/Library/ColorSync/Profiles",+ "/Library/Extensions", "/Library/Fonts", "/Library/Frameworks", "/Library/Printers",+ "/Library/SystemExtensions", "/System", "/Users", "/Users/Shared", "/etc", "/opt", "/private", "/private/etc",+ "/private/tmp", "/private/var", "/tmp", "/usr", "/usr/local", "/usr/local/bin", "/usr/local/etc",+ "/usr/local/include", "/usr/local/lib", "/usr/local/libexec", "/usr/local/sbin", "/usr/local/share",+ "/usr/local/share/doc", "/usr/local/share/man", "/usr/local/share/man/man1", "/var",]/// Returns whether `receipt` is the installer receipt of the app whose bundle identifier is `identifier`:diff --git a/Packages/PeelCore/Tests/PeelCoreTests/PackageReceiptsTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/PackageReceiptsTests.swiftindex eed9a94e..fe9fb6e7 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/PackageReceiptsTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/PackageReceiptsTests.swift@@ -1,9 +1,26 @@import Foundation@testable import PeelCore+import PeelPrivilegedimport Synchronizationimport Testingstruct PackageReceiptsTests {+ @Test func everyFolderPeelSearchesInTheLibraryIsShared() {+ for folder in LibraryFolder.local + LibraryFolder.plugIns {+ #expect(PackageReceipts.sharedDirectories.contains("/Library/" + folder.rawValue), "\(folder)")+ }+ let plugIns = "Library/Application Support/Avid/Audio/Plug-Ins"+ let files = ["Library", "Library/Application Support", "Library/Application Support/Avid",+ "Library/Application Support/Avid/Audio", plugIns, "\(plugIns)/SonoBus.aaxplugin",+ "\(plugIns)/SonoBus.aaxplugin/Contents"]++ let found = PackageReceipts.topLevel(+ files: files, installLocation: "/", namesInside: { _ in [] }, exists: { _ in true }+ )++ #expect(found.offered == ["/\(plugIns)/SonoBus.aaxplugin"])+ }+@Test func keepsOnlyOutermostPackageItems() {let files = ["Adguard.app", "Adguard.app/Contents", "Adguard.app/Contents/Info.plist",