@@ -289,8 +289,6 @@ export class CppProperties {
289289 }
290290 }
291291 } ) ;
292-
293- this . handleConfigurationChange ( ) ;
294292 }
295293 public set CompilerDefaults ( compilerDefaults : CompilerDefaults ) {
296294 this . defaultCompilerPath = compilerDefaults . trustedCompilerFound ? compilerDefaults . compilerPath : null ;
@@ -755,7 +753,7 @@ export class CppProperties {
755753 return result ;
756754 }
757755
758- private resolveAndSplit ( paths : string [ ] | undefined , defaultValue : string [ ] | undefined , env : Environment , glob : boolean = false ) : string [ ] {
756+ private resolveAndSplit ( paths : string [ ] | undefined , defaultValue : string [ ] | undefined , env : Environment , assumeRelative : boolean = true , glob : boolean = false ) : string [ ] {
759757 const resolvedVariables : string [ ] = [ ] ;
760758 if ( paths === undefined ) {
761759 return resolvedVariables ;
@@ -767,7 +765,7 @@ export class CppProperties {
767765 // Do not futher try to resolve a "${env:VAR}"
768766 resolvedVariables . push ( resolvedVariable ) ;
769767 } else {
770- const entries : string [ ] = resolvedVariable . split ( path . delimiter ) . map ( e => glob ? this . resolvePath ( e , false ) : e ) . filter ( e => e ) ;
768+ const entries : string [ ] = resolvedVariable . split ( path . delimiter ) . map ( e => glob ? this . resolvePath ( e , false , assumeRelative ) : e ) . filter ( e => e ) ;
771769 resolvedVariables . push ( ...entries ) ;
772770 }
773771 } ) ;
@@ -838,12 +836,12 @@ export class CppProperties {
838836 return property ;
839837 }
840838
841- private updateConfigurationPathsArray ( paths : string [ ] | undefined , defaultValue : string [ ] | undefined , env : Environment ) : string [ ] | undefined {
839+ private updateConfigurationPathsArray ( paths : string [ ] | undefined , defaultValue : string [ ] | undefined , env : Environment , assumeRelative : boolean = true ) : string [ ] | undefined {
842840 if ( paths ) {
843- return this . resolveAndSplit ( paths , defaultValue , env , true ) ;
841+ return this . resolveAndSplit ( paths , defaultValue , env , assumeRelative , true ) ;
844842 }
845843 if ( ! paths && defaultValue ) {
846- return this . resolveAndSplit ( defaultValue , [ ] , env , true ) ;
844+ return this . resolveAndSplit ( defaultValue , [ ] , env , assumeRelative , true ) ;
847845 }
848846 return paths ;
849847 }
@@ -934,7 +932,7 @@ export class CppProperties {
934932
935933 configuration . macFrameworkPath = this . updateConfigurationStringArray ( configuration . macFrameworkPath , settings . defaultMacFrameworkPath , env ) ;
936934 configuration . windowsSdkVersion = this . updateConfigurationString ( configuration . windowsSdkVersion , settings . defaultWindowsSdkVersion , env ) ;
937- configuration . forcedInclude = this . updateConfigurationPathsArray ( configuration . forcedInclude , settings . defaultForcedInclude , env ) ;
935+ configuration . forcedInclude = this . updateConfigurationPathsArray ( configuration . forcedInclude , settings . defaultForcedInclude , env , false ) ;
938936 configuration . compileCommands = this . updateConfigurationString ( configuration . compileCommands , settings . defaultCompileCommands , env ) ;
939937 configuration . compilerArgs = this . updateConfigurationStringArray ( configuration . compilerArgs , settings . defaultCompilerArgs , env ) ;
940938 configuration . cStandard = this . updateConfigurationString ( configuration . cStandard , settings . defaultCStandard , env ) ;
@@ -1094,7 +1092,7 @@ export class CppProperties {
10941092 }
10951093
10961094 if ( configuration . forcedInclude ) {
1097- configuration . forcedInclude = configuration . forcedInclude . map ( ( path : string ) => this . resolvePath ( path ) ) ;
1095+ configuration . forcedInclude = configuration . forcedInclude . map ( ( path : string ) => this . resolvePath ( path , true , false ) ) ;
10981096 }
10991097
11001098 if ( configuration . includePath ) {
@@ -1513,7 +1511,7 @@ export class CppProperties {
15131511 return success ;
15141512 }
15151513
1516- private resolvePath ( input_path : string | undefined , replaceAsterisks : boolean = true ) : string {
1514+ private resolvePath ( input_path : string | undefined , replaceAsterisks : boolean = true , assumeRelative : boolean = true ) : string {
15171515 if ( ! input_path || input_path === "${default}" ) {
15181516 return "" ;
15191517 }
@@ -1537,10 +1535,12 @@ export class CppProperties {
15371535 result = result . replace ( / \* / g, "" ) ;
15381536 }
15391537
1540- // Make sure all paths result to an absolute path.
1541- // Do not add the root path to an unresolved env variable.
1542- if ( ! result . includes ( "env:" ) && ! path . isAbsolute ( result ) && this . rootUri ) {
1543- result = path . join ( this . rootUri . fsPath , result ) ;
1538+ if ( assumeRelative ) {
1539+ // Make sure all paths result to an absolute path.
1540+ // Do not add the root path to an unresolved env variable.
1541+ if ( ! result . includes ( "env:" ) && ! path . isAbsolute ( result ) && this . rootUri ) {
1542+ result = path . join ( this . rootUri . fsPath , result ) ;
1543+ }
15441544 }
15451545
15461546 return result ;
@@ -1634,7 +1634,7 @@ export class CppProperties {
16341634 errors . browsePath = this . validatePath ( config . browse ? config . browse . path : undefined ) ;
16351635
16361636 // Validate files
1637- errors . forcedInclude = this . validatePath ( config . forcedInclude , { isDirectory : false , skipRelativePaths : true } ) ;
1637+ errors . forcedInclude = this . validatePath ( config . forcedInclude , { isDirectory : false , assumeRelative : false } ) ;
16381638 errors . compileCommands = this . validatePath ( config . compileCommands , { isDirectory : false } ) ;
16391639 errors . dotConfig = this . validatePath ( config . dotConfig , { isDirectory : false } ) ;
16401640 errors . databaseFilename = this . validatePath ( config . browse ? config . browse . databaseFilename : undefined , { isDirectory : false } ) ;
@@ -1650,7 +1650,7 @@ export class CppProperties {
16501650 return errors ;
16511651 }
16521652
1653- private validatePath ( input : string | string [ ] | undefined , { isDirectory = true , skipRelativePaths = false , globPaths = false } = { } ) : string | undefined {
1653+ private validatePath ( input : string | string [ ] | undefined , { isDirectory = true , assumeRelative = true , globPaths = false } = { } ) : string | undefined {
16541654 if ( ! input ) {
16551655 return undefined ;
16561656 }
@@ -1666,7 +1666,7 @@ export class CppProperties {
16661666 }
16671667
16681668 // Resolve and split any environment variables
1669- paths = this . resolveAndSplit ( paths , undefined , this . ExtendedEnvironment , globPaths ) ;
1669+ paths = this . resolveAndSplit ( paths , undefined , this . ExtendedEnvironment , assumeRelative , globPaths ) ;
16701670
16711671 for ( const p of paths ) {
16721672 let pathExists : boolean = true ;
@@ -1677,7 +1677,7 @@ export class CppProperties {
16771677
16781678 // Check if resolved path exists
16791679 if ( ! fs . existsSync ( resolvedPath ) ) {
1680- if ( skipRelativePaths && ! path . isAbsolute ( resolvedPath ) ) {
1680+ if ( assumeRelative && ! path . isAbsolute ( resolvedPath ) ) {
16811681 continue ;
16821682 } else if ( ! this . rootUri ) {
16831683 pathExists = false ;
0 commit comments