(str: string)
| 26 | } |
| 27 | |
| 28 | export function substituteVariables(str: string): string { |
| 29 | let result = str; |
| 30 | if (str.includes('${')) { |
| 31 | result = substituteVariable(result, '${userHome}', () => homedir()); |
| 32 | result = substituteVariable(result, '${workspaceFolder}', () => getCurrentWorkspaceFolder()?.uri.fsPath); |
| 33 | result = substituteVariable(result, '${fileWorkspaceFolder}', () => getActiveFileWorkspaceFolder()?.uri.fsPath); |
| 34 | result = substituteVariable(result, '${fileDirname}', () => { |
| 35 | const activeFilePath = vscode.window.activeTextEditor?.document.uri.fsPath; |
| 36 | if (activeFilePath) { |
| 37 | return path.dirname(activeFilePath); |
| 38 | } |
| 39 | }); |
| 40 | } |
| 41 | return result; |
| 42 | } |
| 43 | |
| 44 | function getRfromEnvPath(platform: string) { |
| 45 | let splitChar = ':'; |
no test coverage detected