Skip to content

Free fork of NotProton: Windows Steam games in Mac Steam, on CodeWeavers' Wine and Apple's Game Porting Toolkit

fix(runners): drop a removed build's tool from Steam's compatibility tools

raymondchinsb2a2bce53de7
diff --git a/app/Sources/NotProtonApp/Model/RunnerStore.swift b/app/Sources/NotProtonApp/Model/RunnerStore.swift
index 07156bb..8e2a073 100644
--- a/app/Sources/NotProtonApp/Model/RunnerStore.swift
+++ b/app/Sources/NotProtonApp/Model/RunnerStore.swift
@@ -162,12 +162,13 @@ enum CompatToolList {
)
try atomicReplace(file, with: Data(text.utf8), step: String(localized: "Update compatibility tools"))
}
- prune(keeping: Set(builds.map(\.id)), runners: runners, bridge: bridge, compatTools: compatTools)
+ prune(keeping: Set(builds.map(\.id)), tools: Set(tools.map(\.name)),
+ runners: runners, bridge: bridge, compatTools: compatTools)
return changed
}
private static func prune(
- keeping ids: Set<String>, runners: URL, bridge: URL, compatTools: URL
+ keeping ids: Set<String>, tools: Set<String>, runners: URL, bridge: URL, compatTools: URL
) {
let legacyInUse = legacyLayoutInUse(compatTools: compatTools)
NtdllPatcher.pruneBuilds(keeping: ids, in: bridge, keepingLegacy: legacyInUse)
@@ -176,6 +177,11 @@ enum CompatToolList {
if (try? FileManager.default.destinationOfSymbolicLink(atPath: legacy)) != nil {
try? FileManager.default.removeItem(atPath: legacy)
}
+ // A tool whose build is gone (Remove Copy, a dropped engine) would stay in Steam's list
+ // and fail on launch, so every NotProton tool the list no longer names goes too.
+ for tool in SupportPaths.Steam.notprotonTools(in: compatTools) where !tools.contains(tool.lastPathComponent) {
+ try? FileManager.default.removeItem(at: tool)
+ }
}
// Old run scripts read runners/current and bridge/wine/<arch>. Steam keeps running them
diff --git a/app/Tests/NotProtonAppTests/RunnerSwitchTests.swift b/app/Tests/NotProtonAppTests/RunnerSwitchTests.swift
index d4d1e72..5ef50cc 100644
--- a/app/Tests/NotProtonAppTests/RunnerSwitchTests.swift
+++ b/app/Tests/NotProtonAppTests/RunnerSwitchTests.swift
@@ -210,6 +210,25 @@ struct RunnerPrepareTests {
atPath: file.deletingLastPathComponent().path(percentEncoded: false)))
}
+ @Test("A tool whose build is gone leaves Steam's compatibility tools; the others and foreign tools stay")
+ func staleToolIsPruned() throws {
+ let runners = try makeRunners(cloning: [Self.rosetta])
+ defer { try? FileManager.default.removeItem(at: runners) }
+ let fm = FileManager.default
+ let compat = runners.appending(path: "compatibilitytools.d")
+ for name in ["notproton-gone", "GE-Proton"] {
+ try fm.createDirectory(at: compat.appending(path: name), withIntermediateDirectories: true)
+ try Data("#!/bin/sh\n".utf8).write(to: compat.appending(path: "\(name)/run"))
+ }
+
+ try sync(runners)
+
+ let kept = try #require(toolList(runners)).split(separator: "\n").compactMap { $0.split(separator: "\t").first }
+ #expect(!kept.isEmpty)
+ #expect(!fm.fileExists(atPath: compat.appending(path: "notproton-gone").path(percentEncoded: false)))
+ #expect(fm.fileExists(atPath: compat.appending(path: "GE-Proton").path(percentEncoded: false)))
+ }
+
private func sync(_ runners: URL) throws {
try CompatToolList.sync(
runners: runners, bridge: runners.appending(path: "bridge"), file: runners.appending(path: "tools"),
diff --git a/dylib/version.h b/dylib/version.h
index 74c7bf9..9183292 100644
--- a/dylib/version.h
+++ b/dylib/version.h
@@ -2,6 +2,6 @@
#ifndef NOTPROTON_VERSION_H
#define NOTPROTON_VERSION_H
-#define NOTPROTON_VERSION "1.1.7-winehq.1-ray.18"
+#define NOTPROTON_VERSION "1.1.7-winehq.1-ray.19"
#endif // NOTPROTON_VERSION_H