Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[General/Protocol] Fix protocol not launching gog games #1969

Merged
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 13 additions & 4 deletions src/backend/protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { BrowserWindow, dialog } from 'electron'
import { logError, logInfo, LogPrefix } from './logger/logger'
import i18next from 'i18next'
import { getGame } from './utils'
import { Runner } from 'common/types'
import { getAppInfo } from './sideload/games'

export async function handleProtocol(window: BrowserWindow, args: string[]) {
// Figure out which argv element is our protocol
Expand Down Expand Up @@ -31,11 +33,18 @@ export async function handleProtocol(window: BrowserWindow, args: string[]) {
}

if (command === 'launch') {
const game =
getGame(arg, 'legendary').getGameInfo() ||
getGame(arg, 'gog').getGameInfo()
const runners: Runner[] = ['legendary', 'gog', 'sideload']

if (!game) {
const game = runners
.map((runner) =>
runner === 'sideload'
imLinguin marked this conversation as resolved.
Show resolved Hide resolved
? getAppInfo(arg)
: getGame(arg, runner).getGameInfo()
)
.filter(({ app_name }) => app_name)
.shift()

if (!game?.app_name) {
imLinguin marked this conversation as resolved.
Show resolved Hide resolved
return logError(`Could not receive game data for ${arg}!`, {
prefix: LogPrefix.ProtocolHandler
})
Expand Down