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
Write a path under /private one way in peel's output
Țugui Dragoș34f89ffecf59
diff --git a/Packages/PeelCore/Sources/PeelCommandLine/Support/Output.swift b/Packages/PeelCore/Sources/PeelCommandLine/Support/Output.swiftindex 17b3bd04..790d492a 100644--- a/Packages/PeelCore/Sources/PeelCommandLine/Support/Output.swift+++ b/Packages/PeelCore/Sources/PeelCommandLine/Support/Output.swift@@ -156,7 +156,12 @@ enum Output {/// The full path with no trailing slash, the same form `peel inventory` and every record use.static func path(_ url: URL) -> String {- PathPattern.comparablePath(of: url)+ let path = PathPattern.comparablePath(of: url)+ // Foundation leaves `/private` out of these links of macOS's only for a path that exists.+ let isUnderALink = ["/private/var/", "/private/tmp/", "/private/etc/"].contains {+ path.utf8.starts(with: $0.utf8)+ }+ return isUnderALink ? String(path.dropFirst("/private".count)) : path}/// Names joined as an English list: "A", "A and B", "A, B, and C".diff --git a/Packages/PeelCore/Tests/PeelCoreTests/CommandLineTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/CommandLineTests.swiftindex 31a94496..106c2b6a 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/CommandLineTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/CommandLineTests.swift@@ -521,6 +521,20 @@ struct CommandLineTests {}/// `peel leftovers --json` names the folders macOS kept Peel out of, where the app may have left more.+ @Test func aPathReadsTheSameWhetherOrNotAnythingIsThere() throws {+ let directory = try TemporaryDirectory()+ let there = try directory.file("there.txt")+ let real = PathPattern.located(there.path(percentEncoded: false)) ?? ""+ #expect(real.hasPrefix("/private/"), "the temporary folder is under /private")+ let gone = real + ".gone"++ #expect(Output.path(URL(filePath: real)) == String(real.dropFirst("/private".count)))+ #expect(Output.path(URL(filePath: gone)) == String(gone.dropFirst("/private".count)))+ #expect(Output.path(URL(filePath: "/private/tmp/org.example/gone")) == "/tmp/org.example/gone")+ #expect(Output.path(URL(filePath: "/private/etc/org.example")) == "/etc/org.example")+ #expect(Output.path(URL(filePath: "/private/other/gone")) == "/private/other/gone")+ }+@Test func theLeftoversReportSaysWhereItCouldNotLook() throws {let app = InstalledApp(url: URL(filePath: "/Applications/Editor.app", directoryHint: .isDirectory), bundleIdentifier: "com.example.editor", name: "Editor")let unread = SearchLocation(kind: .containers, url: URL(filePath: "/Users/me/Library/Containers", directoryHint: .isDirectory))