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
Find the folders an IDE keeps for each release, version and all
Țugui Dragoș4b62344abb0a
diff --git a/Packages/PeelCore/Sources/PeelCore/Leftovers/LeftoverMatcher.swift b/Packages/PeelCore/Sources/PeelCore/Leftovers/LeftoverMatcher.swiftindex 581add90..8ebd3754 100644--- a/Packages/PeelCore/Sources/PeelCore/Leftovers/LeftoverMatcher.swift+++ b/Packages/PeelCore/Sources/PeelCore/Leftovers/LeftoverMatcher.swift@@ -160,11 +160,14 @@ extension LeftoverMatcher {struct Candidate {let key: Stringlet normalized: String+ /// The name without a version written right after it, normalized, for a folder kept for one release.+ let withoutVersion: String?let isApple: Boolinit(_ key: String) {self.key = key.lowercased()normalized = Naming.normalized(key)+ withoutVersion = Naming.withoutAttachedVersion(key).map(Naming.normalized)isApple = ProtectedData.isApplesName(key)}}@@ -318,6 +321,9 @@ extension LeftoverMatcher {if normalizedNames.contains(candidate.normalized) {return Evidence(.name, .likely, specificity: candidate.normalized.count)}+ if let release = candidate.withoutVersion, normalizedNames.contains(release) {+ return Evidence(.name, .likely, specificity: release.count)+ }if let teamPrefix, key.hasPrefix(teamPrefix) {return Evidence(.teamIdentifier, .possible, specificity: teamPrefix.count)}diff --git a/Packages/PeelCore/Sources/PeelCore/Leftovers/Naming.swift b/Packages/PeelCore/Sources/PeelCore/Leftovers/Naming.swiftindex 0854213a..238c8dad 100644--- a/Packages/PeelCore/Sources/PeelCore/Leftovers/Naming.swift+++ b/Packages/PeelCore/Sources/PeelCore/Leftovers/Naming.swift@@ -31,6 +31,19 @@ enum Naming {return isSignificant(base) ? base : nil}+ /// "IntelliJIdea2026.2" → "IntelliJIdea". JetBrains writes the version of a release right after the product's+ /// name in the folders it keeps for it (its "Directories used by the IDE"), and Android Studio names its own the+ /// same way. A number with no dot is kept, since it is as often part of a name.+ static func withoutAttachedVersion(_ name: String) -> String? {+ guard let last = name.lastIndex(where: { !$0.isNumber && $0 != "." }), name[last].isLetter else { return nil }+ let version = name[name.index(after: last)...]+ guard version.contains("."), version.first?.isNumber == true, version.last?.isNumber == true,+ !version.contains("..")+ else { return nil }+ let base = String(name[...last])+ return isSignificant(base) ? base : nil+ }+/// True when `key` starts with `name` followed by a separator. Expects both arguments lowercased.static func hasNamePrefix(_ key: String, name: String) -> Bool {guard key.count > name.count, key.hasPrefix(name) else { return false }diff --git a/Packages/PeelCore/Tests/PeelCoreTests/LeftoverMatcherTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/LeftoverMatcherTests.swiftindex 5ba8357c..e3878f01 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/LeftoverMatcherTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/LeftoverMatcherTests.swift@@ -329,6 +329,25 @@ struct LeftoverMatcherTests {#expect(matcher.match(fileName: "Muse", kind: .applicationSupport) == nil)}+ @Test func matchesAFolderNamedAfterTheAppWithItsVersionRightAfterTheName() {+ let studio = InstalledApp(+ url: URL(filePath: "/Applications/Example Studio.app"),+ bundleIdentifier: "org.example.studio",+ name: "Example Studio"+ )+ let matcher = LeftoverMatcher(app: studio, installedApps: [studio])++ for kind in [SearchLocation.Kind.applicationSupport, .caches, .logs] {+ #expect(matcher.match(fileName: "ExampleStudio2025.1", kind: kind)?.reason == .name, "\(kind)")+ }+ #expect(matcher.match(fileName: "ExampleStudioPreview2025.2", kind: .applicationSupport) == nil)+ #expect(Naming.withoutAttachedVersion("IntelliJIdea2026.2") == "IntelliJIdea")+ #expect(Naming.withoutAttachedVersion("Python3.12") == "Python")+ #expect(Naming.withoutAttachedVersion("Notes2") == nil, "a number without a dot is no version")+ #expect(Naming.withoutAttachedVersion("2025.1") == nil)+ #expect(Naming.withoutAttachedVersion("Studio2025.1.") == nil)+ }+/// Only a trailing number counts as a version, so a name that ends in a word is kept whole.@Test func keepsTheWholeNameWhenTheLastWordIsNotAVersion() {#expect(Naming.withoutTrailingVersion("MuseScore 4") == "MuseScore")diff --git a/Packages/PeelCore/Tests/PeelCoreTests/LeftoverScannerTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/LeftoverScannerTests.swiftindex ad6f72fd..2dced790 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/LeftoverScannerTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/LeftoverScannerTests.swift@@ -1220,6 +1220,29 @@ struct LeftoverScannerTests {#expect(found["home/Library/Example Audio/org.example.hexachord"]?.match.isRecommended == true)}+ @Test func findsTheFoldersOfEachReleaseInsideItsMakersFolder() async throws {+ let directory = try TemporaryDirectory()+ let app = InstalledApp(+ url: URL(filePath: "/Applications/Example Studio.app"),+ bundleIdentifier: "org.example.studio",+ name: "Example Studio"+ )+ let releases = [+ "Application Support/Example Maker/ExampleStudio2025.1", "Caches/Example Maker/ExampleStudio2025.2",+ "Logs/Example Maker/ExampleStudio2025.2",+ ]+ for release in releases {+ try directory.file("home/Library/\(release)/state.db", bytes: 64)+ }+ try directory.file("home/Library/Application Support/Example Maker/OtherProduct2025.1/state.db", bytes: 64)++ let scan = await LeftoverScanner(environment: environment(in: directory)).scan(app, installedApps: [app])++ let home = directory.url.appending(path: "home/Library").path(percentEncoded: false) + "/"+ let found = scan.leftovers.map { String($0.url.path(percentEncoded: false).dropFirst(home.count)) }+ #expect(Set(found) == Set(releases))+ }+/// A kernel extension an app's driver installed stays in `/Library/Extensions` after the app goes. It is found by/// the identifier it declares and listed, but only an administrator can move it and Peel's helper does not serve/// that folder, so it can never be selected.