From 9e671bb97f86a5742321a8eb47822d12d56e50eb Mon Sep 17 00:00:00 2001 From: Maoijoon <162554031+Maoijoon@users.noreply.github.com> Date: Wed, 31 Jul 2024 03:45:38 -0400 Subject: [PATCH] Add Wine to PATH if it's bundled in FPSoftware On Mac & Linux systems, check if the `FPSoftware/Wine/bin` directory exists relative to fpPath. If it does, add it to the PATH, so Wine launches without the user having to modify the PATH themselves. The PATH will not be modified if the directory doesn't exist, or if the launcher is running on Windows (obviously). --- src/back/GameLauncher.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/back/GameLauncher.ts b/src/back/GameLauncher.ts index 38d102fd4..6ee415f5a 100644 --- a/src/back/GameLauncher.ts +++ b/src/back/GameLauncher.ts @@ -376,6 +376,12 @@ export namespace GameLauncher { ...newEnvVars, 'WINEDEBUG': 'fixme-all', ...(proxy !== '' ? {'http_proxy': `http://${proxy}/`, 'HTTP_PROXY': `http://${proxy}/`} : null) }; + // If WINE's bin directory exists in FPSoftware, add it to the PATH + if (fs.existsSync(`${fpPath}/FPSoftware/Wine/bin`)) { + newEnvVars = { + ...newEnvVars, 'PATH': `${fpPath}/FPSoftware/Wine/bin:` + process.env.PATH + } + } } return { // Copy this processes environment variables