@@ -13,15 +13,14 @@ type ParamTypeMap = Map<CxParamType, string>;
1313
1414export class CxWrapper {
1515 config : CxConfig = new CxConfig ( ) ;
16+ cxInstaller : CxInstaller = new CxInstaller ( process . platform ) ;
1617 windows = 'win32' ;
1718 mac = 'darwin' ;
1819 linux = 'linux' ;
1920
2021
2122 constructor ( cxScanConfig : CxConfig , logFilePath ?: string ) {
2223 getLoggerWithFilePath ( logFilePath )
23- const cxInstaller = new CxInstaller ( process . platform ) ;
24- this . config . pathToExecutable = cxInstaller . getExecutablePath ( ) ;
2524 if ( cxScanConfig . apiKey ) {
2625 this . config . apiKey = cxScanConfig . apiKey ;
2726 } else if ( cxScanConfig . clientId && cxScanConfig . clientSecret ) {
@@ -31,7 +30,11 @@ export class CxWrapper {
3130 } else {
3231 logger . info ( "Did not receive ClientId/Secret or ApiKey from cli arguments" ) ;
3332 }
34- this . config . pathToExecutable = cxInstaller . getExecutablePath ( ) ;
33+ if ( cxScanConfig . pathToExecutable ) {
34+ this . config . pathToExecutable = cxScanConfig . pathToExecutable ;
35+ } else {
36+ this . config . pathToExecutable = this . cxInstaller . getExecutablePath ( ) ;
37+ }
3538 if ( cxScanConfig . baseUri ) {
3639 this . config . baseUri = cxScanConfig . baseUri ;
3740 }
@@ -47,9 +50,8 @@ export class CxWrapper {
4750 }
4851
4952 async initializeCommands ( formatRequired : boolean ) : Promise < string [ ] > {
50- const cxInstaller = new CxInstaller ( process . platform ) ;
51- await cxInstaller . downloadIfNotInstalledCLI ( )
52- this . config . pathToExecutable = cxInstaller . getExecutablePath ( ) ;
53+ await this . cxInstaller . downloadIfNotInstalledCLI ( )
54+ this . config . pathToExecutable = this . cxInstaller . getExecutablePath ( ) ;
5355
5456 const list : string [ ] = [ ] ;
5557 if ( this . config . clientId ) {
0 commit comments