From de4307e2a542cd6d000c7306c9a5d084bdc0903c Mon Sep 17 00:00:00 2001 From: Daniel Freitas Date: Sat, 11 May 2024 22:19:12 -0300 Subject: [PATCH] fix: game installing do not reach linux steps --- src/main/events/library/open-game-installer.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/main/events/library/open-game-installer.ts b/src/main/events/library/open-game-installer.ts index 796e063b..2edd88eb 100644 --- a/src/main/events/library/open-game-installer.ts +++ b/src/main/events/library/open-game-installer.ts @@ -15,9 +15,9 @@ const openGameInstaller = async ( ) => { const game = await gameRepository.findOne({ where: { id: gameId } }); - if (!game) return true; + if (!game || !game.folderName) return true; - const gamePath = path.join( + let gamePath = path.join( game.downloadPath ?? (await getDownloadsPath()), game.folderName ); @@ -28,13 +28,12 @@ const openGameInstaller = async ( } const setupPath = path.join(gamePath, "setup.exe"); - if (!fs.existsSync(setupPath)) { - shell.openPath(gamePath); - return true; + if (fs.existsSync(setupPath)) { + gamePath = setupPath; } if (process.platform === "win32") { - shell.openPath(setupPath); + shell.openPath(gamePath); return true; } @@ -46,7 +45,7 @@ const openGameInstaller = async ( } if (spawnSync("which", ["wine"]).status === 0) { - exec(`wine "${setupPath}"`); + exec(`wine "${gamePath}"`); return true; }