@@ -88,7 +88,7 @@ export class CppProperties {
8888 private vcpkgIncludes : string [ ] = [ ] ;
8989 private vcpkgPathReady : boolean = false ;
9090 private defaultIntelliSenseMode : string = null ;
91- private readonly configurationGlobPattern : string = "**/ c_cpp_properties.json" ; // TODO: probably should be a single file, not all files...
91+ private readonly configurationGlobPattern : string = "c_cpp_properties.json" ;
9292 private disposables : vscode . Disposable [ ] = [ ] ;
9393 private configurationsChanged = new vscode . EventEmitter < Configuration [ ] > ( ) ;
9494 private selectionChanged = new vscode . EventEmitter < number > ( ) ;
@@ -247,27 +247,25 @@ export class CppProperties {
247247
248248 private async buildVcpkgIncludePath ( ) : Promise < void > {
249249 try {
250- // Check for vcpkg instance and include relevent paths if found.
251- if ( await util . checkFileExists ( util . getVcpkgPathDescriptorFile ( ) ) ) {
252- let vcpkgRoot : string = await util . readFileText ( util . getVcpkgPathDescriptorFile ( ) ) ;
253- vcpkgRoot = vcpkgRoot . trim ( ) ;
254- if ( await util . checkDirectoryExists ( vcpkgRoot ) ) {
255- let vcpkgInstalledPath : string = path . join ( vcpkgRoot , "/installed" ) ;
256- let list : string [ ] = await util . readDir ( vcpkgInstalledPath ) ;
257- if ( list !== undefined ) {
258- // For every *directory* in the list (non-recursive). Each directory is basically a platform.
259- list . forEach ( ( entry ) => {
260- if ( entry !== "vcpkg" ) {
261- let pathToCheck : string = path . join ( vcpkgInstalledPath , entry ) ;
262- if ( fs . existsSync ( pathToCheck ) ) {
263- let p : string = path . join ( pathToCheck , "include" ) ;
264- if ( fs . existsSync ( p ) ) {
265- this . vcpkgIncludes . push ( p ) ;
266- }
250+ // Check for vcpkgRoot and include relevent paths if found.
251+ let vcpkgRoot : string = util . getVcpkgRoot ( ) ;
252+ if ( vcpkgRoot ) {
253+ let list : string [ ] = await util . readDir ( vcpkgRoot ) ;
254+ if ( list !== undefined ) {
255+ // For every *directory* in the list (non-recursive). Each directory is basically a platform.
256+ list . forEach ( ( entry ) => {
257+ if ( entry !== "vcpkg" ) {
258+ let pathToCheck : string = path . join ( vcpkgRoot , entry ) ;
259+ if ( fs . existsSync ( pathToCheck ) ) {
260+ let p : string = path . join ( pathToCheck , "include" ) ;
261+ if ( fs . existsSync ( p ) ) {
262+ p = p . replace ( / \\ / g, "/" ) ;
263+ p = p . replace ( vcpkgRoot , "${vcpkgRoot}" ) ;
264+ this . vcpkgIncludes . push ( p ) ;
267265 }
268266 }
269- } ) ;
270- }
267+ }
268+ } ) ;
271269 }
272270 }
273271 } catch ( error ) { } finally {
0 commit comments