Free fork of NotProton: Windows Steam games in Mac Steam, on CodeWeavers' Wine and Apple's Game Porting Toolkit
Swift apple-silicond3dmetaldxmtdxvkgame-porting-toolkitgptkmac-gamingmacosmetalfxrosetta-2steamsteam-playwinewinecx
fix(install): say what blocked a revert that could not be written (#2248)
Raymond Chin0e1a6efa3485
diff --git a/app/Sources/BridgeplayApp/Model/SteamInstaller.swift b/app/Sources/BridgeplayApp/Model/SteamInstaller.swiftindex 30af7fa..2e64472 100644--- a/app/Sources/BridgeplayApp/Model/SteamInstaller.swift+++ b/app/Sources/BridgeplayApp/Model/SteamInstaller.swift@@ -476,9 +476,12 @@ enum SteamInstaller {static func revertFailed(_ error: Error, _ revertFailure: Error) -> StepFailure {let own = error as? StepFailurelet cause = own.flatMap { $0.step == step ? $0.detail : nil } ?? error.localizedDescription+ // A refused write only says it could not write files, which leaves out the one part+ // the person can act on: what is holding the write off.+ let advice = (revertFailure as? WriteRefused).map { " " + $0.remedy.advice } ?? ""return StepFailure(step: step,- detail: cause + " " + String(localized: "Putting Steam back as it was also failed, so Steam may not start: \(revertFailure.localizedDescription) Use Repair Steam to restore it."),+ detail: cause + " " + String(localized: "Putting Steam back as it was also failed, so Steam may not start: \(revertFailure.localizedDescription) Use Repair Steam to restore it.") + advice,retryable: own?.retryable == true)}diff --git a/app/Tests/BridgeplayAppTests/SteamInstallerTests.swift b/app/Tests/BridgeplayAppTests/SteamInstallerTests.swiftindex baa3067..47d271a 100644--- a/app/Tests/BridgeplayAppTests/SteamInstallerTests.swift+++ b/app/Tests/BridgeplayAppTests/SteamInstallerTests.swift@@ -493,6 +493,20 @@ struct SteamInstallerTests {#expect(!other.retryable)}+ @Test("A revert refused by permissions says what is holding it off")+ func revertFailureCarriesTheRemedy() {+ let signing = StepFailure(step: SteamInstaller.step, detail: "x could not be signed.")+ let refused = SteamInstaller.revertFailed(signing, WriteRefused(path: "/x", remedy: .appManagement))+ #expect(refused.detail.contains(Remedy.appManagement.advice))++ let rooted = SteamInstaller.revertFailed(signing, WriteRefused(path: "/x", remedy: .rootOwned(handOver: "/Applications/Steam.app")))+ #expect(rooted.detail.contains(Remedy.chownCommand("/Applications/Steam.app")))++ // Any other failure is reported as it is, with no advice to add.+ let started = SteamInstaller.revertFailed(signing, SteamInstaller.ClientStarted())+ #expect(started.detail.hasSuffix("Use Repair Steam to restore it."))+ }+@Test("A broken seal this account can't sign again is reported, not taken as installed")func brokenSealElsewhereIsReported() throws {let other = try #require(SteamInstaller.brokenSealDetail(.otherAccount))