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

Function escapeArgsForShell

src/back/GameLauncher.ts:443–465  ·  view source on GitHub ↗
(gameArgs: string | string[])

Source from the content-addressed store, hash-verified

441 * @param gameArgs Argument(s) to escape
442 */
443export function escapeArgsForShell(gameArgs: string | string[]): string[] {
444 if (typeof gameArgs === 'string') {
445 switch (process.platform) {
446 case 'win32':
447 return [`${escapeWin(gameArgs)}`];
448 case 'darwin':
449 case 'linux':
450 return [`${escapeLinuxArgs(gameArgs)}`];
451 default:
452 throw Error('Unsupported platform');
453 }
454 } else {
455 switch (process.platform) {
456 case 'win32':
457 return gameArgs.map(a => `${escapeWin(a)}`);
458 case 'darwin':
459 case 'linux':
460 return gameArgs.map(a => `${escapeLinuxArgs(a)}`);
461 default:
462 throw Error('Unsupported platform');
463 }
464 }
465}
466
467/**
468 * Escape a string that will be used in a Windows shell (command line)

Callers 2

registerRequestCallbacksFunction · 0.90
runGameServiceFunction · 0.90

Calls 3

escapeWinFunction · 0.85
escapeLinuxArgsFunction · 0.85
mapMethod · 0.65

Tested by

no test coverage detected