Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion Mythic/Utilities/GameManager/EpicGamesGameManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,20 @@ extension EpicGamesGameManager: StorefrontGameManager {
guard case .epicGames = game.storefront,
let castGame = game as? EpicGamesGame else { throw CocoaError(.coderInvalidValue) }

return try await install(game: castGame, qualityOfService: qualityOfService)
// The typed overload requires `forPlatform:` and offers no default for it, so
// `install(game: castGame, qualityOfService:)` re-selects *this* witness (EpicGamesGame is a
// Game) and recurses until the stack dies. Resolve a platform explicitly instead.
// Windows wins when both are offered: it is the superset in practice, and Mythic runs it
// through Wine either way.
let supportedPlatforms = castGame.getSupportedPlatforms() ?? .init()
let resolvedPlatform: Game.Platform? = supportedPlatforms.contains(.windows)
? .windows
: supportedPlatforms.first
guard let resolvedPlatform else { throw CocoaError(.coderInvalidValue) }

return try await install(game: castGame,
forPlatform: resolvedPlatform,
qualityOfService: qualityOfService)
}

static func update(game: Game, qualityOfService: QualityOfService) async throws -> GameOperation {
Expand Down
4 changes: 3 additions & 1 deletion Mythic/Utilities/GameManager/LocalGameManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,12 @@ class LocalGameManager {
throw CocoaError(.fileNoSuchFile)
}

let operation: GameOperation = .init(game: game, type: .uninstall) { _ in
let operation: GameOperation = .init(game: game, type: .move) { _ in
try FileManager.default.moveItem(at: currentLocation, to: newLocation)
game.installationState = .installed(location: newLocation, platform: platform)
}

Game.operationManager.queueOperation(operation)
return operation
}

Expand Down