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

Function createCommand

src/back/GameLauncher.ts:389–407  ·  view source on GitHub ↗
(launchInfo: LaunchInfo)

Source from the content-addressed store, hash-verified

387 }
388
389 function createCommand(launchInfo: LaunchInfo): string {
390 // This whole escaping thing is horribly broken. We probably want to switch
391 // to an array representing the argv instead and not have a shell
392 // in between.
393 const { gamePath, gameArgs, useWine } = launchInfo;
394 const args = typeof gameArgs === 'string' ? [gameArgs] : gameArgs;
395 switch (process.platform) {
396 case 'win32':
397 return `"${gamePath}" ${args.join(' ')}`;
398 case 'darwin':
399 case 'linux':
400 if (useWine) {
401 return `wine start /wait /unix "${gamePath}" ${args.join(' ')}`;
402 }
403 return `"${gamePath}" ${args.join(' ')}`;
404 default:
405 throw Error('Unsupported platform');
406 }
407 }
408
409 function logProcessOutput(proc: ChildProcess): void {
410 // Log for debugging purposes

Callers 1

launchCbFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected