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
Offer no command line link from a temporary copy, on Home too
Țugui Dragoș7c2f1bebfaa6
diff --git a/Packages/PeelCore/Sources/PeelCore/Home/Access.swift b/Packages/PeelCore/Sources/PeelCore/Home/Access.swiftindex 35a2bd99..53f132e7 100644--- a/Packages/PeelCore/Sources/PeelCore/Home/Access.swift+++ b/Packages/PeelCore/Sources/PeelCore/Home/Access.swift@@ -89,10 +89,13 @@ public enum CommandLineTool {}/// The shell command that links the tool, built from where Peel really is rather than a fixed path, or nil once the- /// link leads to this copy's tool and where something that may not be Peel's is in the link's place. `ln -f`- /// deletes what is there, so only a link to another Peel's tool is replaced. A single quote in the path is closed,- /// escaped, and reopened, so the shell reads the path as written.+ /// link leads to this copy's tool, where something that may not be Peel's is in the link's place, and from a+ /// temporary copy, whose link would lead nowhere once Peel quits. `ln -f` deletes what is there, so only a link to+ /// another Peel's tool is replaced. A single quote in the path is closed, escaped, and reopened, so the shell reads+ /// the path as written.public static func installCommand(embedded: URL, standing: Standing) -> String? {+ let bundle = embedded.deletingLastPathComponent().deletingLastPathComponent().deletingLastPathComponent()+ guard place(of: bundle) != .temporaryCopy else { return nil }let path = embedded.path(percentEncoded: false).replacingOccurrences(of: "'", with: "'\\''")let link = switch standing {case .missing: "ln -s"diff --git a/Packages/PeelCore/Tests/PeelCoreTests/HomeTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/HomeTests.swiftindex 86e9950e..3f0fdfb8 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/HomeTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/HomeTests.swift@@ -252,6 +252,9 @@ struct AppManagementTests {#expect(CommandLineTool.installCommand(embedded: embedded, standing: .missing) == "sudo mkdir -p /usr/local/bin && sudo ln -s '/Applications/Peel.app/Contents/Helpers/peel' /usr/local/bin/peel")#expect(CommandLineTool.installCommand(embedded: embedded, standing: .otherPeel) == "sudo mkdir -p /usr/local/bin && sudo ln -sf '/Applications/Peel.app/Contents/Helpers/peel' /usr/local/bin/peel")#expect(CommandLineTool.installCommand(embedded: embedded, standing: .somethingElse) == nil)+ let translocated = URL(filePath: "/private/var/folders/x/AppTranslocation/41B9A/d/Peel.app/Contents/Helpers/peel")+ #expect(CommandLineTool.installCommand(embedded: translocated, standing: .missing) == nil)+ #expect(CommandLineTool.installCommand(embedded: translocated, standing: .otherPeel) == nil)#expect(CommandLineTool.installCommand(embedded: embedded, standing: .installed) == nil)}diff --git a/Peel/Views/Settings/SettingsView.swift b/Peel/Views/Settings/SettingsView.swiftindex 0142e9c1..49fff997 100644--- a/Peel/Views/Settings/SettingsView.swift+++ b/Peel/Views/Settings/SettingsView.swift@@ -341,8 +341,7 @@ private struct GeneralSettingsView: View {LabeledContent {if commandLine == .installed {state("Installed", "checkmark.circle", .green)- } else if Self.place != .temporaryCopy, let installCommand {- // Not offered from a temporary copy: a link into it would break as soon as Peel quits.+ } else if let installCommand {CopyButton(text: installCommand)}} label: {