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
Keep DaVinci Resolve's project libraries unselected
Țugui Dragoș367aac88e263
diff --git a/Packages/PeelCore/Sources/PeelCore/Leftovers/KeptOnlyHere.swift b/Packages/PeelCore/Sources/PeelCore/Leftovers/KeptOnlyHere.swiftindex b0696356..beebce73 100644--- a/Packages/PeelCore/Sources/PeelCore/Leftovers/KeptOnlyHere.swift+++ b/Packages/PeelCore/Sources/PeelCore/Leftovers/KeptOnlyHere.swift@@ -280,8 +280,7 @@ enum KeptOnlyHere {}if let first = held.min(by: { $0.order < $1.order }) { return first.reason }}- // What an app names as its backups is a copy the person may need, whichever app made it.- return namesBackups(item.last ?? "") ? .holdsWorkMadeWithTheApp : nil+ return namesWorkMadeWithAnApp(item.last ?? "") ? .holdsWorkMadeWithTheApp : nil}private struct Place {@@ -303,11 +302,13 @@ enum KeptOnlyHere {}static func reason(seenIn contents: FolderContents) -> HoldBack? {- contents.holdsBackups ? .holdsWorkMadeWithTheApp : nil+ contents.holdsWorkMadeWithAnApp ? .holdsWorkMadeWithTheApp : nil}- static func namesBackups(_ name: String) -> Bool {+ /// Whether an app gives this name to the person's work or its copies, whichever app it is: backups, and+ /// `Resolve Disk Database`, where DaVinci Resolve's Reference Manual keeps local project libraries by default.+ static func namesWorkMadeWithAnApp(_ name: String) -> Bool {let words = name.lowercased().split { !$0.isLetter }- return words.contains("backup") || words.contains("backups")+ return words.contains("backup") || words.contains("backups") || words == ["resolve", "disk", "database"]}}diff --git a/Packages/PeelCore/Sources/PeelCore/Support/FileSize.swift b/Packages/PeelCore/Sources/PeelCore/Support/FileSize.swiftindex 6c8996e3..c75578f4 100644--- a/Packages/PeelCore/Sources/PeelCore/Support/FileSize.swift+++ b/Packages/PeelCore/Sources/PeelCore/Support/FileSize.swift@@ -15,8 +15,9 @@ public struct FolderContents: Sendable, Hashable {public let holdsWallet: Bool/// True when a password database or its key file was seen inside (`isPasswordDatabase(_:)`).public let holdsPasswordDatabase: Bool- /// True when something directly inside is named as backups: a file, or a folder that holds something.- public let holdsBackups: Bool+ /// True when something directly inside goes by a name an app gives to the person's work or its copies+ /// (`KeptOnlyHere.namesWorkMadeWithAnApp(_:)`): a file, or a folder that holds something.+ public let holdsWorkMadeWithAnApp: Bool/// The latest modification date of anything inside. A folder's own date does not change when a file in/// it is rewritten in place.public let newestChange: Date?@@ -39,7 +40,7 @@ public struct FolderContents: Sendable, Hashable {holdsRepository: Bool,holdsWallet: Bool = false,holdsPasswordDatabase: Bool = false,- holdsBackups: Bool = false,+ holdsWorkMadeWithAnApp: Bool = false,newestChange: Date? = nil,couldNotBeRead: Bool = false,closedByPermissions: Bool = false,@@ -50,7 +51,7 @@ public struct FolderContents: Sendable, Hashable {self.holdsRepository = holdsRepositoryself.holdsWallet = holdsWalletself.holdsPasswordDatabase = holdsPasswordDatabase- self.holdsBackups = holdsBackups+ self.holdsWorkMadeWithAnApp = holdsWorkMadeWithAnAppself.newestChange = newestChangeself.couldNotBeRead = couldNotBeReadself.closedByPermissions = closedByPermissions@@ -209,7 +210,7 @@ public enum FileSize {var holdsRepository = repositoryMarkers.contains(url.lastPathComponent)var holdsWallet = isWallet(url.lastPathComponent)var holdsPasswordDatabase = isPasswordDatabase(url.lastPathComponent)- var holdsBackups = false+ var holdsWorkMadeWithAnApp = falsevar newestChange: Date?// A file with several names goes only once every name has gone, so it counts once, and only when all of// its names are inside.@@ -226,9 +227,9 @@ public enum FileSize {if repositoryMarkers.contains(file.lastPathComponent) { holdsRepository = true }if isWallet(file.lastPathComponent) { holdsWallet = true }if isPasswordDatabase(file.lastPathComponent) { holdsPasswordDatabase = true }- if !holdsBackups, enumerator.level == 2,- KeptOnlyHere.namesBackups(file.deletingLastPathComponent().lastPathComponent) {- holdsBackups = true+ if !holdsWorkMadeWithAnApp, enumerator.level == 2,+ KeptOnlyHere.namesWorkMadeWithAnApp(file.deletingLastPathComponent().lastPathComponent) {+ holdsWorkMadeWithAnApp = true}guard let values = try? file.resourceValues(forKeys: fileKeys) else { return .next }if let written = values.contentModificationDate, written > newestChange ?? .distantPast {@@ -238,8 +239,9 @@ public enum FileSize {if isDataless(file) { enumerator.skipDescendants() }return .next}- if !holdsBackups, enumerator.level == 1, KeptOnlyHere.namesBackups(file.lastPathComponent) {- holdsBackups = true+ if !holdsWorkMadeWithAnApp, enumerator.level == 1,+ KeptOnlyHere.namesWorkMadeWithAnApp(file.lastPathComponent) {+ holdsWorkMadeWithAnApp = true}if let links = values.linkCount, links > 1, let identifier = values.fileIdentifier {severalNames[identifier, default: (0, links, Int64(values.totalFileAllocatedSize ?? 0))].seen += 1@@ -262,7 +264,7 @@ public enum FileSize {holdsRepository: holdsRepository,holdsWallet: holdsWallet,holdsPasswordDatabase: holdsPasswordDatabase,- holdsBackups: holdsBackups,+ holdsWorkMadeWithAnApp: holdsWorkMadeWithAnApp,newestChange: newestChange,couldNotBeRead: refused.happened,closedByPermissions: refused.closedByPermissions,diff --git a/Packages/PeelCore/Tests/PeelCoreTests/FileSizeTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/FileSizeTests.swiftindex 6b8f33cb..921ab766 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/FileSizeTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/FileSizeTests.swift@@ -491,24 +491,28 @@ struct FileSizeTests {}}- @Test func reportsBackupsKeptDirectlyInside() async throws {+ @Test func reportsWorkAnAppNamesDirectlyInside() async throws {let directory = try TemporaryDirectory()let novels = try directory.directory("novels")try directory.file("novels/Backups/My Novel.bak.zip", bytes: 64)let library = try directory.directory("library")try directory.file("library/library-backup.sqlite", bytes: 64)+ let resolve = try directory.directory("resolve")+ try directory.file("resolve/Resolve Disk Database/Resolve Projects/Project.db", bytes: 64)let empty = try directory.directory("empty")try directory.directory("empty/Backups")+ try directory.directory("empty/Resolve Disk Database")let deeper = try directory.directory("deeper")try directory.file("deeper/User/globalStorage/state.vscdb.backup", bytes: 64)let lookalike = try directory.directory("lookalike")try directory.file("lookalike/Backupify/settings.json", bytes: 64)+ try directory.file("lookalike/Resolve Cache/clip.bin", bytes: 64)- for folder in [novels, library] {- #expect(await FileSize.contents(of: folder)?.holdsBackups == true, "\(folder.lastPathComponent)")+ for folder in [novels, library, resolve] {+ #expect(await FileSize.contents(of: folder)?.holdsWorkMadeWithAnApp == true, "\(folder.lastPathComponent)")}for folder in [empty, deeper, lookalike] {- #expect(await FileSize.contents(of: folder)?.holdsBackups == false, "\(folder.lastPathComponent)")+ #expect(await FileSize.contents(of: folder)?.holdsWorkMadeWithAnApp == false, "\(folder.lastPathComponent)")}}diff --git a/Packages/PeelCore/Tests/PeelCoreTests/KeptOnlyHereTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/KeptOnlyHereTests.swiftindex 4b4b8114..40ceb309 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/KeptOnlyHereTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/KeptOnlyHereTests.swift@@ -127,6 +127,11 @@ struct KeptOnlyHereTests {("Library/BBEdit", .holdsWorkMadeWithTheApp),("Library/BBEdit/Auto-Save Recovery/a.bbautosave", .holdsWorkMadeWithTheApp),("Library/Containers/com.barebones.bbedit", .holdsWorkMadeWithTheApp),+ (+ "Library/Application Support/Blackmagic Design/DaVinci Resolve/Resolve Disk Database",+ .holdsWorkMadeWithTheApp+ ),+ ("Projects/Resolve Disk Database", .holdsWorkMadeWithTheApp),("Library/Application Support/Tunnelblick/Configurations/work.tblk", .holdsVPNConnections),("Library/Application Support/Viscosity", .holdsVPNConnections),("Library/Application Support/Steam", .holdsWorkMadeWithTheApp),