Skip to content

Run Windows games on Apple Silicon — free, open source, with an open compatibility database that tells you what actually works.

epic install: answer Legendary's selective-download prompt on the command line, it has no terminal here (#110)

Gauthier Piarrette9c943ae771a6
diff --git a/Sources/HighballKit/EpicStore.swift b/Sources/HighballKit/EpicStore.swift
index 5281358..05340aa 100644
--- a/Sources/HighballKit/EpicStore.swift
+++ b/Sources/HighballKit/EpicStore.swift
@@ -177,13 +177,21 @@ public struct EpicStore: Sendable {
return p.hasPrefix(c)
}
+ /// The install command line. Legendary runs without a terminal here, so every prompt must
+ /// be answered on the command line: `-y` covers the confirmations, and `--skip-sdl` the
+ /// selective-download prompt (optional language packs), which `-y` does not cover and which
+ /// otherwise dies with EOFError the moment it reads stdin (Hogwarts Legacy on Epic, #110).
+ /// The defaults install the required data only; language packs can be added later.
+ static func installArguments(appName: String, basePath: String) -> [String] {
+ ["install", appName, "--platform", "Windows", "--base-path", basePath, "-y", "--skip-sdl"]
+ }
+
/// Installs a game's Windows build into the bottle at drive_c/Games/<folder>.
@discardableResult
public func install(_ appName: String, into bottle: Bottle, onLine: (@Sendable (String) -> Void)? = nil) throws -> Int32 {
let base = bottle.driveC.appending(path: "Games", directoryHint: .isDirectory)
try FileManager.default.createDirectory(at: base, withIntermediateDirectories: true)
- return try runStreaming(["install", appName, "--platform", "Windows",
- "--base-path", base.path, "-y"], onLine: onLine)
+ return try runStreaming(Self.installArguments(appName: appName, basePath: base.path), onLine: onLine)
}
public struct LaunchInfo: Sendable {
diff --git a/Tests/HighballKitTests/EpicStoreTests.swift b/Tests/HighballKitTests/EpicStoreTests.swift
new file mode 100644
index 0000000..ab9111d
--- /dev/null
+++ b/Tests/HighballKitTests/EpicStoreTests.swift
@@ -0,0 +1,14 @@
+import XCTest
+@testable import HighballKit
+
+final class EpicStoreTests: XCTestCase {
+ /// Legendary has no terminal under Highball: the selective-download prompt (optional
+ /// language packs) raised EOFError and killed the install (#110). `-y` alone does not skip it.
+ func testInstallAnswersEveryPromptOnTheCommandLine() {
+ let args = EpicStore.installArguments(appName: "Phoenix", basePath: "/c/Games")
+ XCTAssertTrue(args.contains("-y"))
+ XCTAssertTrue(args.contains("--skip-sdl"))
+ XCTAssertEqual(Array(args.prefix(2)), ["install", "Phoenix"])
+ XCTAssertEqual(args[args.firstIndex(of: "--base-path")! + 1], "/c/Games")
+ }
+}