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
List the caches of an Electron app's own sessions too
Țugui Dragoșc4a9c52c9f62
diff --git a/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift b/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swiftindex 4f0c53b4..fa42cd3a 100644--- a/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift+++ b/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift@@ -1180,11 +1180,19 @@ public enum DeveloperCaches {else { return nil }let data = "Library/Application Support/\(name)"guard exists(home.appending(path: "\(data)/Local State")) else { return nil }+ // Each persistent session an app opens keeps the same caches in a folder of its own.+ let partitions = "\(data)/Partitions/*"+ let partition = electron + "electron_browser_context.cc#L384-L390"let folders = [Folder("\(data)/Cache", .cache, source: electron + "net/network_context_service.cc#L94-L95"),Folder("\(data)/Code Cache", .cache, source: codeCache),- ] + ["GPUCache", "DawnWebGPUCache", "DawnGraphiteCache"].map {- Folder("\(data)/\($0)", .cache, source: chromium + "gpu/ipc/common/gpu_disk_cache_type.cc#L43-L50")+ Folder("\(partitions)/Cache", .cache, source: partition),+ Folder("\(partitions)/Code Cache", .cache, source: partition),+ ] + ["GPUCache", "DawnWebGPUCache", "DawnGraphiteCache"].flatMap { cache in+ [+ Folder("\(data)/\(cache)", .cache, source: chromium + "gpu/ipc/common/gpu_disk_cache_type.cc#L43-L50"),+ Folder("\(partitions)/\(cache)", .cache, source: partition),+ ]} + ["ShaderCache", "GrShaderCache", "GraphiteDawnCache", "GPUPersistentCache"].map {Folder("\(data)/\($0)", .cache, source: electron + "electron_browser_client.cc#L1206-L1222")}diff --git a/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swiftindex ae020612..d6d7a365 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift@@ -249,6 +249,34 @@ struct DeveloperCachesTests {#expect(chat.locations.map(\.url.lastPathComponent).sorted() == ["Cache", "GPUCache"])}+ @Test func listsTheCachesOfAnElectronAppsPartitionsAndNeverTheirStorage() async throws {+ let directory = try TemporaryDirectory()+ let home = directory.url.appending(path: "home", directoryHint: .isDirectory)+ try directory.directory("Applications/Chat.app/Contents/Frameworks/Electron Framework.framework")+ let chat = InstalledApp(+ url: directory.url.appending(path: "Applications/Chat.app", directoryHint: .isDirectory),+ bundleIdentifier: "org.example.chat", name: "Chat", bundleName: "Chat"+ )+ let partition = "home/Library/Application Support/Chat/Partitions/workspace"+ try directory.file("home/Library/Application Support/Chat/Local State")+ try directory.file("\(partition)/Cache/Cache_Data/index", bytes: 4_096)+ try directory.file("\(partition)/Code Cache/js/index", bytes: 4_096)+ try directory.file("\(partition)/GPUCache/data_0", bytes: 4_096)+ try directory.file("\(partition)/Local Storage/leveldb/000003.log", bytes: 4_096)+ try directory.file("\(partition)/IndexedDB/https_app.example_0.indexeddb.leveldb/000003.log", bytes: 4_096)++ let environments = await DeveloperCaches.scan(+ DeveloperCaches.electronDefinitions(for: [chat], home: home), homeDirectory: home+ )++ let listed = try #require(environments.first).locations.map {+ $0.url.pathComponents.suffix(3).joined(separator: "/")+ }+ #expect(listed.sorted() == [+ "Partitions/workspace/Cache", "Partitions/workspace/Code Cache", "Partitions/workspace/GPUCache",+ ])+ }+@Test func readsTheAppsInTheFoldersChosenInTheHomeItScans() async throws {let directory = try TemporaryDirectory()let tools = try directory.directory("Tools")