fix: gog game install path detection to prefer stored value - #1808
Conversation
📝 WalkthroughWalkthroughGOG executable discovery and Wine launch command construction now prefer the persisted game ChangesGOG path resolution
Estimated code review effort: 1 (Trivial) | ~5 minutes Mergeability Score: 🟡 Moderate · up to When a stored GOG install path is empty, verification can fail before the computed path is used, causing an otherwise installed game not to launch. The PR is not merge-ready until path resolution occurs before verification. Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@app/src/main/java/app/gamenative/service/gog/GOGManager.kt`:
- Around line 740-741: The launch flow in GOGManager currently verifies
game.installPath before applying the computed fallback. Resolve the effective
install path with game.installPath.ifEmpty { getGameInstallPath(...) } before
calling verifyInstallation, and update verifyInstallation to validate that
resolved path while preserving the existing failure behavior for invalid
installations.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 36cd661e-d001-4f9d-913a-2d90e96ddb08
📒 Files selected for processing (1)
app/src/main/java/app/gamenative/service/gog/GOGManager.kt
| val gameInstallPath = game.installPath.ifEmpty { getGameInstallPath(gameId.toString(), game.title) } | ||
| val gameDir = File(gameInstallPath) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Make the computed-path fallback reachable before verification.
When game.installPath is empty, verifyInstallation(gameId.toString()) runs first and validates the empty stored path. It returns failure before the fallback at Line 740 is used. An installed game with a valid computed path can therefore still fail to launch.
Resolve the effective install path before verification, then make verifyInstallation validate that resolved path.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@app/src/main/java/app/gamenative/service/gog/GOGManager.kt` around lines 740
- 741, The launch flow in GOGManager currently verifies game.installPath before
applying the computed fallback. Resolve the effective install path with
game.installPath.ifEmpty { getGameInstallPath(...) } before calling
verifyInstallation, and update verifyInstallation to validate that resolved path
while preserving the existing failure behavior for invalid installations.
There was a problem hiding this comment.
1 issue found across 1 file
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="app/src/main/java/app/gamenative/service/gog/GOGManager.kt">
<violation number="1" location="app/src/main/java/app/gamenative/service/gog/GOGManager.kt:599">
P2: Preferring the stored path with `ifEmpty` selects a stale/non-existent `installPath` over a valid computed path, and then forces an early failure return (`""` in `getInstalledExe`, `"explorer.exe"` in `getGogWineStartCommand`) instead of falling back to the computed location. The sibling helper `getScriptInterpreterPartsForLaunch` already guards with an existence check (`game.installPath.isNotEmpty() && File(game.installPath).exists()`). This can happen when external storage is removed/relocated or after a reinstall leaves the DB `installPath` pointing at a path that no longer exists while the title-based path is valid. Align this line with that existing pattern so the stored value is used only when its directory actually exists.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| try { | ||
| val game = getGameFromDbById(gameId) ?: return@withContext "" | ||
| val installPath = getGameInstallPath(game.id, game.title) | ||
| val installPath = game.installPath.ifEmpty { getGameInstallPath(game.id, game.title) } |
There was a problem hiding this comment.
P2: Preferring the stored path with ifEmpty selects a stale/non-existent installPath over a valid computed path, and then forces an early failure return ("" in getInstalledExe, "explorer.exe" in getGogWineStartCommand) instead of falling back to the computed location. The sibling helper getScriptInterpreterPartsForLaunch already guards with an existence check (game.installPath.isNotEmpty() && File(game.installPath).exists()). This can happen when external storage is removed/relocated or after a reinstall leaves the DB installPath pointing at a path that no longer exists while the title-based path is valid. Align this line with that existing pattern so the stored value is used only when its directory actually exists.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At app/src/main/java/app/gamenative/service/gog/GOGManager.kt, line 599:
<comment>Preferring the stored path with `ifEmpty` selects a stale/non-existent `installPath` over a valid computed path, and then forces an early failure return (`""` in `getInstalledExe`, `"explorer.exe"` in `getGogWineStartCommand`) instead of falling back to the computed location. The sibling helper `getScriptInterpreterPartsForLaunch` already guards with an existence check (`game.installPath.isNotEmpty() && File(game.installPath).exists()`). This can happen when external storage is removed/relocated or after a reinstall leaves the DB `installPath` pointing at a path that no longer exists while the title-based path is valid. Align this line with that existing pattern so the stored value is used only when its directory actually exists.</comment>
<file context>
@@ -596,7 +596,7 @@ class GOGManager @Inject constructor(
try {
val game = getGameFromDbById(gameId) ?: return@withContext ""
- val installPath = getGameInstallPath(game.id, game.title)
+ val installPath = game.installPath.ifEmpty { getGameInstallPath(game.id, game.title) }
// Try V2 structure first (game_$gameId subdirectory)
</file context>
), wishlist webview (utkarshdalal#1812), gamefixes Whisk (utkarshdalal#1813), rec disclosure (utkarshdalal#1814), gog path (utkarshdalal#1808) Conflito único em QuickMenu.kt: PR utkarshdalal#1698 adicionou a aba POWER ao bootstrap de foco, região que o fork reescreveu no hardening de gamepad (spec 2026-08-12-quickmenu-gamepad-pipeline-hardening). Resolução: mantém requestMenuFocus() do fork e absorve o caso POWER — sem retrocesso de nenhum dos lados (comentário before/after no local). Integração pós-merge no código do fork (listas de abas que o upstream não conhece): orderedTabs (L1/R1), focusTabContentOrRail (item + rail), backAction. Código do upstream (powercontrol/, quickMenus/, wishlist, gamefixes, strings) entrou idêntico.
Description
fix: gog game install path detection to prefer stored value
Recording
N/A
Type of Change
Checklist
#code-changes, I have discussed this change there and it has been green-lighted. If I do not have access, I have still provided clear context in this PR. If I skip both, I accept that this change may face delays in review, may not be reviewed at all, or may be closed.CONTRIBUTING.md.Summary by cubic
Prefer the stored GOG install path when resolving game directories, falling back to detection only if the stored value is empty. Previously we always computed the path, which could miss games moved or installed to custom locations.
Review notes
GOGManagerto usegame.installPath.ifEmpty { getGameInstallPath(...) }for directory resolution and Explorer launches.Written for commit 9cbc6a9. Summary will update on new commits.
Summary by CodeRabbit