Skip to content

armgit / peel

Public Imported from GitHub
0

Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.

Plug-ins are matched by the kinds the Plug-ins page knows

Țugui Dragoșc26020c1c2ea
diff --git a/Packages/PeelCore/Sources/PeelCore/Leftovers/LeftoverMatcher.swift b/Packages/PeelCore/Sources/PeelCore/Leftovers/LeftoverMatcher.swift
index b7a74920..bf5f551a 100644
--- a/Packages/PeelCore/Sources/PeelCore/Leftovers/LeftoverMatcher.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Leftovers/LeftoverMatcher.swift
@@ -137,20 +137,14 @@ struct LeftoverMatcher: Sendable {
}
}
- /// The extensions that say a plug-in's kind, listed one by one rather than cutting the name at its last dot:
- /// an unknown kind is missed, never given to the wrong app.
- private static let plugInExtensions = [
- ".component", ".vst3", ".vst", ".clap", ".driver", ".plugin", ".webplugin", ".bundle", ".mailbundle",
- ".prefPane", ".qlgenerator", ".saver", ".qtz", ".mdimporter", ".service", ".workflow", ".colorPicker",
- ".menu", ".inputmethod", ".app", ".aaxplugin", ".dictionary", ".action", ".kext", ".fs",
- ]
+ /// The extensions that say a plug-in's kind: the Plug-ins tool's own table, so the two cannot drift, and a
+ /// driver's and a file system's (`SearchEnvironment.systemCodeFolders`). A name is cut only at one of these,
+ /// never at any last dot: an unknown kind is missed, never given to the wrong app.
+ private static let plugInExtensions = Set(Plugins.extensions.values.joined()).union(["kext", "fs"])
static func withoutPlugInExtension(_ fileName: String) -> String {
- for suffix in plugInExtensions {
- let trimmed = fileName.removingSuffix(suffix)
- if trimmed != fileName { return trimmed }
- }
- return fileName
+ let name = fileName as NSString
+ return plugInExtensions.contains(name.pathExtension.lowercased()) ? name.deletingPathExtension : fileName
}
/// "com.example.app.0A1B2C3D-…" → "com.example.app"
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/LeftoverMatcherTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/LeftoverMatcherTests.swift
index 9fba17fb..02f97be2 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/LeftoverMatcherTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/LeftoverMatcherTests.swift
@@ -413,7 +413,7 @@ struct LeftoverMatcherTests {
let serum = app("com.xferrecords.serum", name: "Serum")
for name in [
"Serum.vst3", "Serum.vst", "Serum.component", "Serum.clap", "Serum.saver", "Serum.aaxplugin", "Serum.action",
- "Serum.dictionary",
+ "Serum.dictionary", "Serum.appex", "Serum.prefPane", "Serum.colorPicker", "Serum.kext", "Serum.fs",
] {
let found = try #require(match(name, in: .plugIns, for: serum), "\(name)")
#expect(found.reason == .name, "\(name)")