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.

Leave what macOS keeps in Application Support out of the look for installers

Țugui Dragoș1553e5cd2fe2
diff --git a/Packages/PeelCore/Sources/PeelCore/Space/Installers.swift b/Packages/PeelCore/Sources/PeelCore/Space/Installers.swift
index 7f7204d6..af439b80 100644
--- a/Packages/PeelCore/Sources/PeelCore/Space/Installers.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Space/Installers.swift
@@ -605,7 +605,8 @@ public enum Installers {
}
/// Installer packages in `~/Library/Application Support`, up to three levels down, never inside a package or in
- /// the device backups. Each is matched by its name to an installed app, or else by the folder it sits in.
+ /// what macOS keeps there for its own services, the device backups and Contacts among them. Each is matched by its
+ /// name to an installed app, or else by the folder it sits in.
static func packagesKeptByApps(
home: URL,
installedApps: [InstalledApp],
@@ -624,7 +625,7 @@ public enum Installers {
guard ["pkg", "mpkg"].contains(url.pathExtension.lowercased()) else {
if depth < 3, url.isRealFolder, !FileSize.isDataless(url),
(try? url.resourceValues(forKeys: [.isPackageKey]).isPackage) != true,
- depth > 1 || url.lastPathComponent != "MobileSync" {
+ depth > 1 || !SystemFolders.keeps(url.lastPathComponent, in: .applicationSupport) {
folders.append((url, depth + 1, owner ?? url.lastPathComponent))
}
continue
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/InstallersTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/InstallersTests.swift
index be8e8dfd..6d4ad4eb 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/InstallersTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/InstallersTests.swift
@@ -545,6 +545,7 @@ struct InstallersTests {
try directory.file("Library/Application Support/Toolbox/Installer.mpkg/Contents/Archive", bytes: 400_000)
try directory.file("Library/Application Support/Toolbox/a/b/Deeper.pkg", bytes: 400_000)
try directory.file("Library/Application Support/MobileSync/Backup.pkg", bytes: 400_000)
+ try directory.file("Library/Application Support/AddressBook/Contacts.pkg", bytes: 400_000)
try directory.file("Library/Application Support/Toolbox/notes.txt", bytes: 400_000)
try directory.directory("Applications")