@@ -762,8 +762,14 @@ export class CppProperties {
762
762
}
763
763
paths = this . resolveDefaults ( paths , defaultValue ) ;
764
764
paths . forEach ( entry => {
765
- const entries : string [ ] = util . resolveVariables ( entry , env ) . split ( path . delimiter ) . map ( e => glob ? this . resolvePath ( e , false ) : e ) . filter ( e => e ) ;
766
- resolvedVariables . push ( ...entries ) ;
765
+ const resolvedVariable : string = util . resolveVariables ( entry , env ) ;
766
+ if ( resolvedVariable . includes ( "env:" ) ) {
767
+ // Do not futher try to resolve a "${env:VAR}"
768
+ resolvedVariables . push ( resolvedVariable ) ;
769
+ } else {
770
+ const entries : string [ ] = resolvedVariable . split ( path . delimiter ) . map ( e => glob ? this . resolvePath ( e , false ) : e ) . filter ( e => e ) ;
771
+ resolvedVariables . push ( ...entries ) ;
772
+ }
767
773
} ) ;
768
774
if ( ! glob ) {
769
775
return resolvedVariables ;
@@ -1487,7 +1493,7 @@ export class CppProperties {
1487
1493
return success ;
1488
1494
}
1489
1495
1490
- public resolvePath ( input_path : string | undefined , replaceAsterisks : boolean = true ) : string {
1496
+ private resolvePath ( input_path : string | undefined , replaceAsterisks : boolean = true ) : string {
1491
1497
if ( ! input_path || input_path === "${default}" ) {
1492
1498
return "" ;
1493
1499
}
@@ -1511,8 +1517,9 @@ export class CppProperties {
1511
1517
result = result . replace ( / \* / g, "" ) ;
1512
1518
}
1513
1519
1514
- // Make sure all paths result to an absolute path
1515
- if ( ! path . isAbsolute ( result ) && this . rootUri ) {
1520
+ // Make sure all paths result to an absolute path.
1521
+ // Do not add the root path to an unresolved env variable.
1522
+ if ( ! result . includes ( "env:" ) && ! path . isAbsolute ( result ) && this . rootUri ) {
1516
1523
result = path . join ( this . rootUri . fsPath , result ) ;
1517
1524
}
1518
1525
0 commit comments