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.

Keep LibreOffice's and OpenOffice's user profile unselected

Țugui Dragoș4c843deacdf8
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a1bbe960..3ae6ec63 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -83,6 +83,8 @@ its changes the way [Keep a Changelog](https://keepachangelog.com/) suggests.
selected, like one holding a KeePass database, and the pages that measure folders hold it back too.
- A torrent client's list of torrents and how far each one got, as Transmission, qBittorrent, BiglyBT, Deluge, Motrix,
and WebTorrent keep them, is listed and never selected: without it the app forgets every transfer.
+- The user profile of LibreOffice and Apache OpenOffice, with your own templates, AutoText, dictionaries, and the
+ automatic backups of your documents, is listed and never selected.
#### Space
diff --git a/Packages/PeelCore/Sources/PeelCore/Leftovers/KeptOnlyHere.swift b/Packages/PeelCore/Sources/PeelCore/Leftovers/KeptOnlyHere.swift
index afe107d2..951029f1 100644
--- a/Packages/PeelCore/Sources/PeelCore/Leftovers/KeptOnlyHere.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Leftovers/KeptOnlyHere.swift
@@ -52,6 +52,11 @@ enum KeptOnlyHere {
// OBS Studio keeps its profiles and scene collections in `obs-studio/basic` in its configuration folder
// (`frontend/OBSApp.cpp`), and nowhere else.
("Library/Application Support/obs-studio", "basic", .holdsWorkMadeWithTheApp),
+ // The user profile of LibreOffice and Apache OpenOffice (`UserInstallation` in their sources, `<name>/4` here
+ // on a Mac). LibreOffice Help's "Paths": the person's own templates, AutoText, AutoCorrect texts and
+ // dictionaries, and the automatic backup copies of documents.
+ ("Library/Application Support/LibreOffice", nil, .holdsWorkMadeWithTheApp),
+ ("Library/Application Support/OpenOffice", nil, .holdsWorkMadeWithTheApp),
// Torrent clients keep each torrent added and how far it got apart from what it downloaded, and forget every
// transfer without them. Transmission's "Configuration Files": `torrents`, `resume` and the Mac app's
// `Transfers.plist`, in this folder.
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/KeptOnlyHereTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/KeptOnlyHereTests.swift
index 1f73deba..19cbd761 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/KeptOnlyHereTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/KeptOnlyHereTests.swift
@@ -29,6 +29,9 @@ struct KeptOnlyHereTests {
("Library/Application Support/Example/Backups", .holdsWorkMadeWithTheApp),
("Library/Application Support/obs-studio", .holdsWorkMadeWithTheApp),
("Library/Application Support/obs-studio/basic/scenes/Untitled.json", .holdsWorkMadeWithTheApp),
+ ("Library/Application Support/LibreOffice", .holdsWorkMadeWithTheApp),
+ ("Library/Application Support/LibreOffice/4/user/basic/Standard/Module1.xba", .holdsWorkMadeWithTheApp),
+ ("Library/Application Support/OpenOffice/4/user/template/Letter.ott", .holdsWorkMadeWithTheApp),
("Library/Application Support/Transmission", .holdsTorrents),
("Library/Application Support/Transmission/Transfers.plist", .holdsTorrents),
("Library/Application Support/qBittorrent", .holdsTorrents),
@@ -71,6 +74,7 @@ struct KeptOnlyHereTests {
".docker/contexts", ".cargo/registry", ".config", ".local/share", ".terraform.d/plugins",
"Library/Application Support/qBittorrent/logs", "Library/Caches/qBittorrent", ".config/deluge/plugins",
"Library/Application Support/Motrix/dht.dat", "Library/Application Support/WebTorrent/Posters",
+ "Library/Caches/LibreOffice", "Library/Application Support/LibreOffice Beta",
]
for path in free {
#expect(KeptOnlyHere.reason(for: "\(home)/\(path)", home: home, root: "/") == nil, "\(path)")
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/LeftoverScannerTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/LeftoverScannerTests.swift
index af7d0aaa..7bbb7c8c 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/LeftoverScannerTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/LeftoverScannerTests.swift
@@ -1984,6 +1984,19 @@ struct LeftoverScannerTests {
#expect(manifests["com.example.bridge.json"]?.match.isRecommended == true)
}
+ @Test func anOfficeSuitesUserProfileIsNotSelected() async throws {
+ let directory = try TemporaryDirectory()
+ try directory.file("home/Library/Application Support/LibreOffice/4/user/template/Letter.ott")
+ let suite = InstalledApp(
+ url: URL(filePath: "/Applications/LibreOffice.app"), bundleIdentifier: "org.example.office",
+ name: "LibreOffice"
+ )
+
+ let scan = await LeftoverScanner(environment: environment(in: directory)).scan(suite, installedApps: [suite])
+
+ #expect(scan.leftovers.map(\.match.heldBack) == [.holdsWorkMadeWithTheApp])
+ }
+
@Test func aTorrentClientsListOfTorrentsIsNotSelected() async throws {
let directory = try TemporaryDirectory()
try directory.file("home/Library/Application Support/Transmission/resume/Example.1a2b3c4d.resume")