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.

Hold back what was just written in sandboxed apps' caches, as in the other cache areas

Țugui Dragoș181bc28d362b
diff --git a/Packages/PeelCore/Sources/PeelCore/Space/SpaceReport.swift b/Packages/PeelCore/Sources/PeelCore/Space/SpaceReport.swift
index b474ab28..e20e7784 100644
--- a/Packages/PeelCore/Sources/PeelCore/Space/SpaceReport.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Space/SpaceReport.swift
@@ -359,7 +359,8 @@ public enum SpaceInventory {
paths: [],
handling: .trash,
containerFolders: ["Data/Library/Caches", "Data/tmp"],
- groupContainerFolder: "Library/Caches"
+ groupContainerFolder: "Library/Caches",
+ holdsBackRecentWrites: true
),
// Sandboxed, Mail writes only the second folder. The first is what an older Mail left in the Library itself.
Definition(
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/SpaceRemovalTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/SpaceRemovalTests.swift
index f387eb8a..d0a3053b 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/SpaceRemovalTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/SpaceRemovalTests.swift
@@ -228,7 +228,8 @@ struct SpaceRemovalTests {
let home = directory.url.appending(path: "home", directoryHint: .isDirectory)
let userCache = directory.url.appending(path: "C", directoryHint: .isDirectory)
let anHourAgo = Date.now.addingTimeInterval(-3600)
- for folder in ["home/Library/Caches", "C", "home/Library/Logs"] {
+ let container = "home/Library/Containers/org.example.app/Data/Library/Caches"
+ for folder in ["home/Library/Caches", "C", "home/Library/Logs", container] {
try directory.file("\(folder)/org.example.busy/data.db")
let idle = try directory.file("\(folder)/org.example.idle/data.db")
for url in [idle, idle.deletingLastPathComponent()] {
@@ -244,7 +245,7 @@ struct SpaceRemovalTests {
measure: LeftoverScanner.walk
)
- for id in ["caches", "user-caches", "logs"] {
+ for id in ["caches", "user-caches", "logs", "container-caches"] {
let area = try #require(report.items.first { $0.id == id })
let plan = await SpaceRemoval.plan(for: area, environment: environment, running: [:])
let busy = try #require(plan.removable.first { $0.lastPathComponent == "org.example.busy" })
diff --git a/SAFETY.md b/SAFETY.md
index c4b9d991..11fe292a 100644
--- a/SAFETY.md
+++ b/SAFETY.md
@@ -386,10 +386,11 @@ Never selected for you, even when found:
unsaved files or a chat history, only the cache inside it.
- A cache or a log macOS keeps for its own services in `~/Library/Caches` or `~/Library/Logs` (Spotlight's caches,
Siri's logs) or in the container of one of Apple's apps.
-- On the Space page, a cache in `~/Library/Caches`, or in the folder macOS gives your account for caches, that
- something wrote to in the last 15 minutes: Peel knows an open app's caches only by the app's names, and a program
- may still be using one under a name of its own. On the Developer page, the same holds for the folders a Spring Boot
- server makes in the temporary folder each time it starts.
+- On the Space page, a cache in `~/Library/Caches`, in the folder macOS gives your account for caches, or in an app's
+ container, that something wrote to in the last 15 minutes: Peel knows an open app's caches only by the app's names,
+ and a program may still be using one under a name of its own, such as an extension that runs without its app. On
+ the Developer page, the same holds for the folders a Spring Boot server makes in the temporary folder each time it
+ starts.
- A log in `/opt/homebrew/var/log` that something wrote to in the last 15 minutes: a running service may hold it
open, and moving it would free nothing.
- `/Users/Shared`: it belongs to every account, not just yours.