MCPcopy Create free account
hub / github.com/FlashpointProject/launcher / getEnvironment

Function getEnvironment

src/back/GameLauncher.ts:364–387  ·  view source on GitHub ↗

* Get an object containing the environment variables to use for the game / additional application. * * @param fpPath Path to Flashpoint Data Folder * @param proxy HTTP_PROXY environmental variable to add to env (For Linux / Mac) * @param path Override PATH environmental variable

(fpPath: string, proxy: string, path?: string)

Source from the content-addressed store, hash-verified

362 * @param path Override PATH environmental variable
363 */
364 function getEnvironment(fpPath: string, proxy: string, path?: string): NodeJS.ProcessEnv {
365 let newEnvVars: NodeJS.ProcessEnv = {'FP_PATH': fpPath, 'PATH': path ?? process.env.PATH};
366 // On Linux, we tell native applications to use Flashpoint's proxy using the HTTP_PROXY env var
367 // On Windows, executables are patched to load the FlashpointProxy library
368 // On Linux/Mac, WINE obeys the HTTP_PROXY env var so we can run unpatched Windows executables
369 if (process.platform === 'linux' || process.platform === 'darwin') {
370 // Add proxy env vars and prevent WINE from flooding the logs with debug messages
371 newEnvVars = {
372 ...newEnvVars, 'WINEDEBUG': 'fixme-all',
373 ...(proxy !== '' ? {'http_proxy': `http://${proxy}/`, 'HTTP_PROXY': `http://${proxy}/`} : null)
374 };
375 // If WINE's bin directory exists in FPSoftware, add it to the PATH
376 if (fs.existsSync(`${fpPath}/FPSoftware/Wine/bin`)) {
377 newEnvVars = {
378 ...newEnvVars, 'PATH': `${fpPath}/FPSoftware/Wine/bin:` + process.env.PATH
379 }
380 }
381 }
382 return {
383 // Copy this processes environment variables
384 ...process.env,
385 ...newEnvVars
386 };
387 }
388
389 function createCommand(launchInfo: LaunchInfo): string {
390 // This whole escaping thing is horribly broken. We probably want to switch

Callers 2

launchGameFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected