@@ -808,6 +808,9 @@ export class CppProperties {
808808 const matches : string [ ] = fastGlob . isDynamicPattern ( normalized ) ?
809809 fastGlob . sync ( normalized , { onlyDirectories : true , cwd, suppressErrors : true , deep : 15 } ) : [ res ] ;
810810 resolvedGlob . push ( ...matches . map ( s => s + suffix ) ) ;
811+ if ( resolvedGlob . length === 0 ) {
812+ resolvedGlob . push ( normalized ) ;
813+ }
811814 } else {
812815 resolvedGlob . push ( normalized + suffix ) ;
813816 }
@@ -1253,11 +1256,28 @@ export class CppProperties {
12531256 }
12541257 }
12551258
1259+ private trimPathWhitespace ( paths : string [ ] | undefined ) : string [ ] | undefined {
1260+ if ( paths === undefined ) {
1261+ return undefined ;
1262+ }
1263+ const trimmedPaths = [ ] ;
1264+ for ( const value of paths ) {
1265+ const fullPath = this . resolvePath ( value ) ;
1266+ if ( fs . existsSync ( fullPath . trim ( ) ) && ! fs . existsSync ( fullPath ) ) {
1267+ trimmedPaths . push ( value . trim ( ) ) ;
1268+ } else {
1269+ trimmedPaths . push ( value ) ;
1270+ }
1271+ }
1272+ return trimmedPaths ;
1273+ }
1274+
12561275 private saveConfigurationUI ( ) : void {
12571276 this . parsePropertiesFile ( ) ; // Clear out any modifications we may have made internally.
12581277 if ( this . settingsPanel && this . configurationJson ) {
12591278 const config : Configuration = this . settingsPanel . getLastValuesFromConfigUI ( ) ;
12601279 this . configurationJson . configurations [ this . settingsPanel . selectedConfigIndex ] = config ;
1280+ this . configurationJson . configurations [ this . settingsPanel . selectedConfigIndex ] . includePath = this . trimPathWhitespace ( this . configurationJson . configurations [ this . settingsPanel . selectedConfigIndex ] . includePath ) ;
12611281 this . settingsPanel . updateErrors ( this . getErrorsForConfigUI ( this . settingsPanel . selectedConfigIndex ) ) ;
12621282 this . writeToJson ( ) ;
12631283 }
0 commit comments