@@ -159,12 +159,13 @@ export class SettingManager {
159159
160160 private getExePathFromConfig ( confName : string , execName : string ) : string | undefined {
161161
162- const path = this . getConfiguration ( ) . get < string > ( confName ) ;
162+ let defPath : string | undefined ;
163163
164+ const path = this . getConfiguration ( ) . get < string > ( confName ) ;
164165 if ( path ) {
165- const absPath = Utility . formatPath ( this . replaceEnvVariable ( path ) ) ;
166- if ( File . IsExist ( absPath ) ) {
167- return absPath ;
166+ defPath = Utility . formatPath ( this . replaceEnvVariable ( path ) ) ;
167+ if ( File . IsExist ( defPath ) ) {
168+ return defPath ;
168169 }
169170 }
170171
@@ -179,16 +180,19 @@ export class SettingManager {
179180 return absPath ;
180181 }
181182 }
183+
184+ return defPath ;
182185 }
183186
184187 private getGccFolderFromConfig ( confName : string , execName : string ) : string | undefined {
185188
186- const path = this . getConfiguration ( ) . get < string > ( confName ) ;
189+ let defPath : string | undefined ;
187190
191+ const path = this . getConfiguration ( ) . get < string > ( confName ) ;
188192 if ( path ) {
189- const absPath = Utility . formatPath ( this . replaceEnvVariable ( path ) ) ;
190- if ( File . IsExist ( absPath ) ) {
191- return absPath ;
193+ defPath = Utility . formatPath ( this . replaceEnvVariable ( path ) ) ;
194+ if ( File . IsExist ( defPath ) ) {
195+ return defPath ;
192196 }
193197 }
194198
@@ -204,6 +208,8 @@ export class SettingManager {
204208 return dirName ;
205209 }
206210 }
211+
212+ return defPath ;
207213 }
208214
209215 //-------------------------- Serialport --------------------------------
@@ -311,16 +317,18 @@ export class SettingManager {
311317
312318 getJlinkDir ( ) : string {
313319
314- const path = this . getConfiguration ( ) . get < string > ( 'JLink.InstallDirectory' ) ;
315- const execName = 'JLink' ;
320+ let defPath : string | undefined ;
316321
322+ const path = this . getConfiguration ( ) . get < string > ( 'JLink.InstallDirectory' ) ;
317323 if ( path ) {
318- const absPath = Utility . formatPath ( this . replaceEnvVariable ( path ) ) ;
319- if ( File . IsExist ( absPath ) ) {
320- return absPath ;
324+ defPath = Utility . formatPath ( this . replaceEnvVariable ( path ) ) ;
325+ if ( File . IsExist ( defPath ) ) {
326+ return defPath ;
321327 }
322328 }
323329
330+ const execName = 'JLink' ;
331+
324332 if ( this . envPathCache . has ( execName ) ) {
325333 return < string > this . envPathCache . get ( execName )
326334 }
@@ -332,8 +340,9 @@ export class SettingManager {
332340 this . envPathCache . set ( execName , dirName ) ;
333341 return dirName ;
334342 }
335- return 'null' ;
336343 }
344+
345+ return defPath || 'null' ;
337346 }
338347
339348 getJlinkDevXmlFile ( ) : File | undefined {
@@ -371,16 +380,18 @@ export class SettingManager {
371380
372381 getIARForStm8Dir ( ) : File {
373382
374- const path = this . getConfiguration ( ) . get < string > ( 'IAR.STM8.InstallDirectory' ) ;
375- const execName = 'iccstm8' ;
383+ let defPath : string | undefined ;
376384
385+ const path = this . getConfiguration ( ) . get < string > ( 'IAR.STM8.InstallDirectory' ) ;
377386 if ( path ) {
378- const absPath = Utility . formatPath ( this . replaceEnvVariable ( path ) ) ;
379- if ( File . IsExist ( absPath ) ) {
380- return new File ( absPath ) ;
387+ defPath = Utility . formatPath ( this . replaceEnvVariable ( path ) ) ;
388+ if ( File . IsExist ( defPath ) ) {
389+ return new File ( defPath ) ;
381390 }
382391 }
383392
393+ const execName = 'iccstm8' ;
394+
384395 if ( this . envPathCache . has ( execName ) ) {
385396 return new File ( < string > this . envPathCache . get ( execName ) )
386397 }
@@ -392,8 +403,9 @@ export class SettingManager {
392403 this . envPathCache . set ( execName , dirName ) ;
393404 return new File ( dirName ) ;
394405 }
395- return new File ( 'null' ) ;
396406 }
407+
408+ return new File ( defPath || 'null' ) ;
397409 }
398410
399411 //---------------------------- ARM ----------------------------
0 commit comments