(extId: string, appPath: string, launchCommand: string, state: BackState)
| 4 | import * as path from 'path'; |
| 5 | |
| 6 | export 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 | } |
no test coverage detected