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.

Orphaned Files holds back what it finds in /Users/Shared

Țugui Dragoș97bfaa12e0be
diff --git a/Packages/PeelCore/Sources/PeelCore/Orphans/OrphanScanner.swift b/Packages/PeelCore/Sources/PeelCore/Orphans/OrphanScanner.swift
index d05590cd..dff3523c 100644
--- a/Packages/PeelCore/Sources/PeelCore/Orphans/OrphanScanner.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Orphans/OrphanScanner.swift
@@ -308,7 +308,8 @@ public struct OrphanScanner: Sendable {
} else if ProtectedData.holdsALibrary(path) {
.holdsALibrary
} else {
- Self.heldBack(by: contents)
+ // `/Users/Shared` belongs to every account on the Mac, and the other accounts' apps are not known here.
+ Self.heldBack(by: contents) ?? (location.kind == .sharedFolder ? .sharedWithEveryone : nil)
}
let item = OrphanItem(
url: url,
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/OrphanScannerTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/OrphanScannerTests.swift
index 37acd1d5..8f0be7dd 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/OrphanScannerTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/OrphanScannerTests.swift
@@ -440,6 +440,19 @@ struct OrphanScannerTests {
#expect(scan.groups.map(\.identifier) == [])
}
+ /// `/Users/Shared` belongs to every account on the Mac, and another account's apps are not known here, so what
+ /// is found there is listed but left for the user to choose, as an uninstall leaves it.
+ @Test func whatIsInTheSharedFolderIsHeldBack() async throws {
+ let directory = try TemporaryDirectory()
+ try directory.file("root/Users/Shared/com.gone.app/library.db")
+ try directory.file("home/Library/Caches/com.gone.app/cache.db")
+
+ let items = await scanner(in: directory).scan(installedApps: installed).groups.flatMap(\.items)
+
+ let heldBack = items.map { "\($0.kind): \($0.heldBack.map(\.rawValue) ?? "none")" }.sorted()
+ #expect(heldBack == ["caches: none", "sharedFolder: sharedWithEveryone"])
+ }
+
/// A group container is there for a maker's apps to share, so another app of that maker claims it as it claims
/// the maker's other files, with `group.` in front of the name or not.
@Test func anotherAppOfTheMakerClaimsItsGroupContainer() async throws {
diff --git a/SAFETY.md b/SAFETY.md
index 26f19ef0..50a6632c 100644
--- a/SAFETY.md
+++ b/SAFETY.md
@@ -154,8 +154,8 @@ exactly the one with work inside, and nothing is selected for you without saying
such a folder out reads "Over" what is known.
Orphaned Files selects nothing for you, and its Select All and `peel orphans --remove` leave these folders out as
-well: one with a repository, a wallet, or a signing key inside, or one Peel could not read or measure in time,
-moves only when you select it yourself.
+well: one in `/Users/Shared`, one with a repository, a wallet, or a signing key inside, or one Peel could not read
+or measure in time, moves only when you select it yourself.
In Duplicates, one copy of every group always stays, and a file that changed since the scan is refused. Nothing
inside an app or another package is ever offered, nor a hidden folder, such as a tool's settings in `~/.config`: