Skip to content

Commit 1ebfd70

Browse files
authored
[UX] Print list of GOG games in GOG log (#4838)
1 parent 220b2b8 commit 1ebfd70

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

src/backend/launcher.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1680,7 +1680,7 @@ async function callRunner(
16801680
await writer.logInfo(
16811681
[prefix, safeCommand, '\n\n'].filter(Boolean).join(' ')
16821682
)
1683-
await writer.logInfo('Game Output:')
1683+
if (appName) await writer.logInfo('Game Output:')
16841684
}
16851685

16861686
const files = options.logWriters

src/backend/storeManagers/gog/library.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import { dirname, join } from 'node:path'
2929
import { existsSync, readFileSync } from 'graceful-fs'
3030

3131
import {
32+
getRunnerLogWriter,
3233
logDebug,
3334
logError,
3435
logInfo,
@@ -447,6 +448,25 @@ export async function refresh(): Promise<ExecResult> {
447448

448449
apiInfoCache.commit() // Sync cache to drive
449450
libraryStore.set('games', gamesObjects)
451+
452+
void new Promise(() => {
453+
const logLines: string[] = []
454+
gamesObjects.forEach((gameData) => {
455+
if (gameData.title == 'Galaxy Common Redistributables') return
456+
457+
let line = `* ${gameData.title} (App name: ${gameData.app_name})`
458+
if (gameData.install.is_dlc) line += ' - DLC'
459+
logLines.push(line)
460+
})
461+
const sortedTitles = logLines.sort((a, b) =>
462+
a.toLowerCase().localeCompare(b.toLowerCase())
463+
)
464+
465+
const logContent = `Games List:\n${sortedTitles.join('\n')}\n\nTotal: ${logLines.length}\n`
466+
const gogLogWriter = getRunnerLogWriter('gog')
467+
void gogLogWriter.logInfo(logContent)
468+
})
469+
450470
logInfo('Saved games data', LogPrefix.Gog)
451471

452472
return defaultExecResult

0 commit comments

Comments
 (0)