diff --git a/Extension/src/LanguageServer/configurations.ts b/Extension/src/LanguageServer/configurations.ts index e9c7a86b2..cfa0996ea 100644 --- a/Extension/src/LanguageServer/configurations.ts +++ b/Extension/src/LanguageServer/configurations.ts @@ -1574,9 +1574,11 @@ export class CppProperties { quoted = true; result = result.slice(1, -1); } + // On Windows, isAbsolute does not handle root paths without a slash, such as "C:" + const isWindowsRootPath: boolean = process.platform === 'win32' && /^[a-zA-Z]:$/.test(result); // Make sure all paths result to an absolute path. // Do not add the root path to an unresolved env variable. - if (!result.includes("env:") && !path.isAbsolute(result) && this.rootUri) { + if (!isWindowsRootPath && !result.includes("env:") && !path.isAbsolute(result) && this.rootUri) { result = path.join(this.rootUri.fsPath, result); } if (quoted) {