Skip to content

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

An installed Epic game moves alone to another environment from its page (Environment, Move to…), through legendary's own move, so it plays there with that environment's engine and settings while the others stay (highball#566: a player testing one game on Wine 11 edited legendary's installed.json by hand). Legendary 0.21.0 renames the folder and rewrites its record, and prints a refusal with status 0 (measured: a full folder of that name answers OSError 66), so the folder's new place decides, and the refusal becomes a sentence. Refused while the game runs. 622 tests pass on the M4.

Gauthier Piarrettedbb8812da068
diff --git a/Sources/HighballApp/AppState.swift b/Sources/HighballApp/AppState.swift
index 2f2e528..184a8b0 100644
--- a/Sources/HighballApp/AppState.swift
+++ b/Sources/HighballApp/AppState.swift
@@ -3221,6 +3221,27 @@ final class AppState {
return EpicStore.isInstalled(path: path, inDriveC: bottle.driveC)
}
+ /// Moves one installed Epic game into another environment, where it then plays with that
+ /// environment's engine and settings while its other games stay put (highball#566: a player
+ /// testing one game on Wine 11 had to edit Legendary's files by hand). The game's home is its
+ /// folder, so moving the folder is the whole move.
+ func moveEpicGame(_ item: LibraryItem, to dest: Bottle) {
+ guard let appName = item.epicAppName, let path = epicInstalls[appName] else { return }
+ if runningSessions.contains(where: { $0.libraryID == item.id }) {
+ fail(HighballError.failed(String(format: L("%@ is running. Quit it first, then move it."), item.title)))
+ return
+ }
+ runBusy(String(format: L("Moving %@ to '%@'"), item.title, dest.name),
+ done: DoneState(title: String(format: L("%@ now plays in '%@'"), item.title, dest.name), ctaTitle: nil, cta: nil)) { [self] in
+ let store = epicStore
+ let refused = try await Task.detached {
+ try store.move(appName, from: path, into: dest) { line in Task { @MainActor in self.appendLog(line) } }
+ }.value
+ await MainActor.run { self.epicRefresh() }
+ if let refused { throw HighballError.failed(String(format: L("%@ could not move. %@"), item.title, refused)) }
+ }
+ }
+
func epicSignIn(code: String) {
runBusy(L("Connecting your Epic account"), stop: .cancelTask(label: L("Stop"))) { [self] in
let store = epicStore
diff --git a/Sources/HighballApp/GameDetailView.swift b/Sources/HighballApp/GameDetailView.swift
index 029cadd..2aad297 100644
--- a/Sources/HighballApp/GameDetailView.swift
+++ b/Sources/HighballApp/GameDetailView.swift
@@ -570,6 +570,17 @@ struct GameDetailView: View {
Text(L("Environment")).font(.caption).foregroundStyle(.secondary).frame(width: 110, alignment: .leading)
Text(bottle.name).font(.callout)
NavigationLink(L("Environment settings…"), value: EnvironmentSettingsDestination(name: bottle.name)).controlSize(.small)
+ // An Epic game lives where its folder is, so it can move alone, where the
+ // engine switch moves every game of the environment (highball#566).
+ if item.source == .epic, item.installed, state.bottles.count > 1 {
+ Menu(L("Move to…")) {
+ ForEach(state.bottles.filter { $0.name != bottle.name }, id: \.name) { other in
+ Button(other.name) { state.moveEpicGame(item, to: other) }
+ }
+ }
+ .controlSize(.small).fixedSize().disabled(state.busy || running != nil)
+ .help(L("Moves this game's folder into another environment, where it plays with that environment's engine and settings. Its other games stay where they are. Saves the game keeps in the environment's user folders stay behind, unless Epic keeps them in the cloud."))
+ }
}
// Another copy plays from its own environment; once played there, the
// tile follows it (highball#264).
diff --git a/Sources/HighballApp/L10n.swift b/Sources/HighballApp/L10n.swift
index 0f953ae..e04e7f9 100644
--- a/Sources/HighballApp/L10n.swift
+++ b/Sources/HighballApp/L10n.swift
@@ -600,6 +600,12 @@ enum L10n {
"Removing one frees its disk space. If a game asks for it again later, Highball downloads it then.": "En supprimer un libère son espace disque. Si un jeu le demande plus tard, Highball le télécharge à nouveau.",
"Removing engine %@": "Suppression du moteur %@",
"Remove engine %@? No environment uses it.": "Supprimer le moteur %@ ? Aucun environnement ne l'utilise.",
+ "Move to…": "Déplacer vers…",
+ "Moving %@ to '%@'": "Déplacement de %@ vers « %@ »",
+ "%@ now plays in '%@'": "%@ se lance maintenant dans « %@ »",
+ "%@ could not move. %@": "%@ n'a pas pu être déplacé. %@",
+ "%@ is running. Quit it first, then move it.": "%@ est en cours. Quittez-le d'abord, puis déplacez-le.",
+ "Moves this game's folder into another environment, where it plays with that environment's engine and settings. Its other games stay where they are. Saves the game keeps in the environment's user folders stay behind, unless Epic keeps them in the cloud.": "Déplace le dossier de ce jeu dans un autre environnement, où il se lance avec le moteur et les réglages de cet environnement. Les autres jeux restent où ils sont. Les sauvegardes que le jeu garde dans les dossiers utilisateur de l'environnement restent sur place, sauf si Epic les garde dans le cloud.",
"Removing %@": "Suppression de %@",
"%@ removed": "%@ supprimé",
"Steam and the Epic tools do their own uninstalling, so their libraries stay right.": "Steam et les outils Epic font eux-mêmes la désinstallation, pour que leurs bibliothèques restent justes.",
diff --git a/Sources/HighballKit/EpicStore.swift b/Sources/HighballKit/EpicStore.swift
index f61f15d..0512165 100644
--- a/Sources/HighballKit/EpicStore.swift
+++ b/Sources/HighballKit/EpicStore.swift
@@ -238,6 +238,40 @@ public struct EpicStore: Sendable {
return Int64(value * 1_048_576)
}
+ static func moveArguments(appName: String, basePath: String) -> [String] { ["move", appName, basePath] }
+
+ /// Moves an installed game's folder into another environment's drive_c/Games and rewrites
+ /// legendary's record of it, so the game alone plays there (highball#566: the engine switch
+ /// moves every game of an environment). Legendary renames the folder, which takes a moment
+ /// whatever the game's size, and it refuses another disk. It prints its refusals and still
+ /// exits 0, so the files decide: nil when the folder now sits in the new place, else why not.
+ public func move(_ appName: String, from installPath: String, into bottle: Bottle,
+ onLine: (@Sendable (String) -> Void)? = nil) throws -> String? {
+ let base = bottle.driveC.appending(path: "Games", directoryHint: .isDirectory)
+ try FileManager.default.createDirectory(at: base, withIntermediateDirectories: true)
+ let refusals = Collector()
+ _ = try runStreaming(Self.moveArguments(appName: appName, basePath: base.path)) { line in
+ if let r = line.range(of: "ERROR: ") { refusals.append(String(line[r.upperBound...])) }
+ onLine?(line)
+ }
+ let moved = base.appending(path: URL(fileURLWithPath: installPath).lastPathComponent).path
+ if FileManager.default.fileExists(atPath: moved), !FileManager.default.fileExists(atPath: installPath) { return nil }
+ return refusals.lines.last.map(Self.moveFailure) ?? "Its folder is still at \(installPath)."
+ }
+
+ /// Legendary's refusal to move, as a sentence for the player.
+ static func moveFailure(_ message: String) -> String {
+ if message.hasPrefix("Moving to a different drive is not supported") {
+ return "The game is on another disk than that environment, and Epic's tool only moves a game within one disk."
+ }
+ // 0.21.0 renames straight onto the target: an empty folder there is replaced, a full one
+ // fails with errno 66 (measured 2026-10-30). Its own check for that case reads this way.
+ if message.contains("Directory not empty") || message.hasPrefix("The target path already contains a folder called") {
+ return "That environment already has a folder of that name in drive_c/Games. Remove or rename it, then try again."
+ }
+ return message
+ }
+
static func uninstallArguments(appName: String) -> [String] { ["uninstall", appName, "-y"] }
/// Removes a game legendary installed. Legendary owns the Epic install state, so it does the
diff --git a/Tests/HighballKitTests/EpicStoreTests.swift b/Tests/HighballKitTests/EpicStoreTests.swift
index 25597ff..f839106 100644
--- a/Tests/HighballKitTests/EpicStoreTests.swift
+++ b/Tests/HighballKitTests/EpicStoreTests.swift
@@ -38,4 +38,45 @@ final class EpicStoreTests: XCTestCase {
XCTAssertEqual(Array(args.prefix(2)), ["install", "Phoenix"])
XCTAssertEqual(args[args.firstIndex(of: "--base-path")! + 1], "/c/Games")
}
+
+ /// highball#566: one Epic game moves to another environment through `legendary move`, which
+ /// prints its refusals and exits 0, so the folder's new place is what says it worked.
+ func testMoveGoesThroughLegendaryAndChecksTheFolder() throws {
+ let home = FileManager.default.temporaryDirectory.appending(path: "hb-epicmove-\(UUID().uuidString)")
+ defer { try? FileManager.default.removeItem(at: home) }
+ let paths = HighballPaths(home: home)
+ let store = EpicStore(paths: paths)
+ let fm = FileManager.default
+ try fm.createDirectory(at: store.binary.deletingLastPathComponent(), withIntermediateDirectories: true)
+ // A stand-in with legendary 0.21.0's behaviour: rename the folder into the new base, or
+ // print the refusal it printed for a full folder of that name there, with status 0.
+ try """
+ #!/bin/sh
+ [ "$1" = move ] || exit 2
+ src="$HB_TEST_SRC"; dst="$3/$(basename "$src")"
+ if [ -n "$(ls -A "$dst" 2>/dev/null)" ]; then echo "[cli] ERROR: Moving failed with unknown error OSError(66, 'Directory not empty')."; exit 0; fi
+ rmdir "$dst" 2>/dev/null
+ mv "$src" "$dst"; echo "[cli] INFO: Finished."
+ """.write(to: store.binary, atomically: true, encoding: .utf8)
+ try fm.setAttributes([.posixPermissions: 0o755], ofItemAtPath: store.binary.path)
+ let a = Bottle(url: home.appending(path: "bottles/A"), settings: BottleSettings(name: "A", engineID: "e"))
+ let b = Bottle(url: home.appending(path: "bottles/B"), settings: BottleSettings(name: "B", engineID: "e"))
+ let game = a.driveC.appending(path: "Games/GetHighEXE")
+ try fm.createDirectory(at: game, withIntermediateDirectories: true)
+ setenv("HB_TEST_SRC", game.path, 1)
+ defer { unsetenv("HB_TEST_SRC") }
+
+ XCTAssertEqual(EpicStore.moveArguments(appName: "app", basePath: "/x/drive_c/Games"), ["move", "app", "/x/drive_c/Games"])
+ XCTAssertNil(try store.move("app", from: game.path, into: b))
+ XCTAssertTrue(fm.fileExists(atPath: b.driveC.appending(path: "Games/GetHighEXE").path))
+ XCTAssertTrue(EpicStore.isInstalled(path: b.driveC.appending(path: "Games/GetHighEXE").path, inDriveC: b.driveC))
+
+ // Back to A while A holds a full folder of that name: refused, and said so.
+ try fm.createDirectory(at: game, withIntermediateDirectories: true)
+ try Data("x".utf8).write(to: game.appending(path: "left.txt"))
+ setenv("HB_TEST_SRC", b.driveC.appending(path: "Games/GetHighEXE").path, 1)
+ XCTAssertEqual(try store.move("app", from: b.driveC.appending(path: "Games/GetHighEXE").path, into: a),
+ "That environment already has a folder of that name in drive_c/Games. Remove or rename it, then try again.")
+ XCTAssertEqual(EpicStore.moveFailure("Moving failed with unknown error PermissionError()."), "Moving failed with unknown error PermissionError().")
+ }
}