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
Say in full where a link the helper refused still leads
Țugui Dragoșdebede45ed43
diff --git a/Packages/PeelCore/Sources/PeelCore/Removal/TrashService.swift b/Packages/PeelCore/Sources/PeelCore/Removal/TrashService.swiftindex 3e70caec..2ec9525d 100644--- a/Packages/PeelCore/Sources/PeelCore/Removal/TrashService.swift+++ b/Packages/PeelCore/Sources/PeelCore/Removal/TrashService.swift@@ -830,7 +830,10 @@ public struct TrashService: Sendable {case .irreplaceable: removalGuard.refusal(of: failure.url).map { .guarded($0) }case .leadsSomewhere:(try? FileManager.default.destinationOfSymbolicLink(atPath: failure.url.path(percentEncoded: false)))- .map { .stillLeadsTo($0) }+ .map { destination in+ let target = URL(filePath: destination, relativeTo: failure.url.deletingLastPathComponent())+ return .stillLeadsTo(target.standardizedFileURL.path(percentEncoded: false))+ }default: nil}return reason.map { TrashFailure(url: failure.url, reason: $0, error: failure.error) } ?? failurediff --git a/Packages/PeelCore/Tests/PeelCoreTests/TrashServiceTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/TrashServiceTests.swiftindex 637be92a..c9c367de 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/TrashServiceTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/TrashServiceTests.swift@@ -1687,8 +1687,12 @@ struct TrashServiceTests {let folder = try directory.directory("home/Library/Caches/org.example.cache")let tool = try directory.file("root/usr/local/lib/org.example/tool")let link = directory.url.appending(path: "root/usr/local/bin/tool")+ let relative = directory.url.appending(path: "root/usr/local/bin/relative")try FileManager.default.createDirectory(at: link.deletingLastPathComponent(), withIntermediateDirectories: true)try FileManager.default.createSymbolicLink(at: link, withDestinationURL: tool)+ try FileManager.default.createSymbolicLink(+ atPath: relative.path(percentEncoded: false), withDestinationPath: "../lib/org.example/tool"+ )let service = TrashService(environment: SearchEnvironment(homeDirectory: directory.url.appending(path: "home"),@@ -1699,17 +1703,18 @@ struct TrashServiceTests {at: folder.appending(path: "Photos Library.photoslibrary"), withIntermediateDirectories: true)return TrashResult(failures: urls.map { url in- let refused = url == link ? PrivilegedPathPolicy.Rejection.leadsSomewhere : .irreplaceable+ let refused = url == folder ? PrivilegedPathPolicy.Rejection.irreplaceable : .leadsSomewherereturn TrashFailure(url: url, reason: .failed(refused.explanation))})},moveToTrash: { _ in throw CocoaError(.fileWriteNoPermission) })- let result = await service.trash([folder, link], usingHelperFor: [folder, link])+ let result = await service.trash([folder, link, relative], usingHelperFor: [folder, link, relative])let reasons = Dictionary(uniqueKeysWithValues: result.failures.map { ($0.url, $0.reason) })#expect(reasons[folder] == .guarded(.holdsALibrary))#expect(reasons[link] == .stillLeadsTo(tool.path(percentEncoded: false)))+ #expect(reasons[relative] == .stillLeadsTo(tool.path(percentEncoded: false)))}}