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

Function parseAppVar

src/back/extensions/util.ts:6–27  ·  view source on GitHub ↗
(extId: string, appPath: string, launchCommand: string, state: BackState)

Source from the content-addressed store, hash-verified

4import * as path from 'path';
5
6export async function parseAppVar(extId: string, appPath: string, launchCommand: string, state: BackState) {
7 const ext = await state.extensionsService.getExtension(extId);
8 return parseVariableString(appPath, (name) => {
9 switch (name) {
10 case 'extPath': return path.resolve(ext ? ext.extensionPath : '');
11 case 'extDataURL': return `http://localhost:${state.fileServerPort}/extdata/${extId}/`;
12 case 'os': return process.platform;
13 case 'arch': return process.arch;
14 case 'launchCommand': return launchCommand;
15 case 'cwd': return fixSlashes(process.cwd());
16 case 'fpPath': return state.config ? path.resolve(fixSlashes(state.config.flashpointPath)) : '';
17 case 'proxy': return state.preferences.browserModeProxy || '';
18 default: {
19 if (name.startsWith('extConf:')) {
20 const key = name.substring(8);
21 return state.extConfig[key];
22 }
23 return '';
24 }
25 }
26 });
27}

Callers 1

getProvidersFunction · 0.90

Calls 3

parseVariableStringFunction · 0.90
fixSlashesFunction · 0.90
getExtensionMethod · 0.80

Tested by

no test coverage detected