Skip to content

Commit 7fbe9b1

Browse files
authored
Fix an issue with C: treated as a relative path (#13297)
1 parent 907b225 commit 7fbe9b1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Diff for: Extension/src/LanguageServer/configurations.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -1574,9 +1574,11 @@ export class CppProperties {
15741574
quoted = true;
15751575
result = result.slice(1, -1);
15761576
}
1577+
// On Windows, isAbsolute does not handle root paths without a slash, such as "C:"
1578+
const isWindowsRootPath: boolean = process.platform === 'win32' && /^[a-zA-Z]:$/.test(result);
15771579
// Make sure all paths result to an absolute path.
15781580
// Do not add the root path to an unresolved env variable.
1579-
if (!result.includes("env:") && !path.isAbsolute(result) && this.rootUri) {
1581+
if (!isWindowsRootPath && !result.includes("env:") && !path.isAbsolute(result) && this.rootUri) {
15801582
result = path.join(this.rootUri.fsPath, result);
15811583
}
15821584
if (quoted) {

0 commit comments

Comments
 (0)