@@ -1062,17 +1062,25 @@ export abstract class AbstractProject implements CustomConfigurationProvider, Pr
10621062 return this . configMap ;
10631063 }
10641064
1065- private replacePathEnv ( path : string ) : string {
1065+ replacePathEnv ( path : string ) : string {
10661066
1067- // replace stable env
1068- path = this . replaceProjEnv ( path ) ;
1067+ for ( let cnt = 0 ; cnt < 5 ; cnt ++ ) {
10691068
1070- // replace user env
1071- return this . replaceUserEnv ( path , true ) ;
1069+ if ( ! File . isEnvPath ( path ) )
1070+ break ; // not have any env var, end
1071+
1072+ // replace stable env
1073+ path = this . _replaceProjEnv ( path ) ;
1074+
1075+ // replace user env
1076+ path = this . _replaceUserEnv ( path , true ) ;
1077+ }
1078+
1079+ return path ;
10721080 }
10731081
10741082 // project internal env vars
1075- replaceProjEnv ( str : string ) : string {
1083+ private _replaceProjEnv ( str : string ) : string {
10761084
10771085 const prjConfig = this . GetConfiguration ( ) ;
10781086 const prjRootDir = this . GetRootDir ( ) ;
@@ -1103,7 +1111,7 @@ export abstract class AbstractProject implements CustomConfigurationProvider, Pr
11031111 }
11041112
11051113 // user defined env vars
1106- replaceUserEnv ( str : string , ignore_case_sensitivity : boolean = false ) : string {
1114+ private _replaceUserEnv ( str : string , ignore_case_sensitivity : boolean = false ) : string {
11071115 const prjEnv = this . getProjectEnv ( ) ;
11081116 if ( prjEnv ) {
11091117 for ( const key in prjEnv ) {
@@ -2828,24 +2836,24 @@ class EIDEProject extends AbstractProject {
28282836 // replace env variables for config
28292837 {
28302838 this . cppToolsConfig . defines = this . cppToolsConfig . defines . map ( ( arg ) => {
2831- return this . replaceUserEnv ( arg ) ;
2839+ return this . replacePathEnv ( arg ) ;
28322840 } ) ;
28332841
28342842 if ( this . cppToolsConfig . compilerArgs ) {
28352843 this . cppToolsConfig . compilerArgs = ( < string [ ] > this . cppToolsConfig . compilerArgs ) . map ( ( arg ) => {
2836- return this . replaceUserEnv ( arg ) ;
2844+ return this . replacePathEnv ( arg ) ;
28372845 } ) ;
28382846 }
28392847
28402848 if ( this . cppToolsConfig . cCompilerArgs ) {
28412849 this . cppToolsConfig . cCompilerArgs = ( < string [ ] > this . cppToolsConfig . cCompilerArgs ) . map ( ( arg ) => {
2842- return this . replaceUserEnv ( arg ) ;
2850+ return this . replacePathEnv ( arg ) ;
28432851 } ) ;
28442852 }
28452853
28462854 if ( this . cppToolsConfig . cppCompilerArgs ) {
28472855 this . cppToolsConfig . cppCompilerArgs = ( < string [ ] > this . cppToolsConfig . cppCompilerArgs ) . map ( ( arg ) => {
2848- return this . replaceUserEnv ( arg ) ;
2856+ return this . replacePathEnv ( arg ) ;
28492857 } ) ;
28502858 }
28512859 }
0 commit comments