Skip to content

Commit 07fd17c

Browse files
authored
Normalize drive letter on windows for presets expanision (#2665)
1 parent aa08f65 commit 07fd17c

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Improvements:
55
- Add a setting to disable reading `compile_commands.json`. [#2586](https://github.com/microsoft/vscode-cmake-tools/issues/2586) [@xiaoyun94](https://github.com/xiaoyun94)
66
- Preset in CMakeUserPresets.json using "condition" does not appear in configure preset selection. [#2749](https://github.com/microsoft/vscode-cmake-tools/issues/2749)
77
- Resolve workspace variables in `cmake-kits.json`. [#2737](https://github.com/microsoft/vscode-cmake-tools/issues/2737)
8+
- Use upper case drive letters on Windows for `cmake.sourceDirectory`. [PR #2665](https://github.com/microsoft/vscode-cmake-tools/pull/2665) [@Danielmelody](https://github.com/Danielmelody)
89

910
## 1.12.27
1011
Bug Fixes:

src/util.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import * as fs from 'fs';
44
import * as path from 'path';
55
import * as vscode from 'vscode';
66
import * as nls from 'vscode-nls';
7-
import { platform } from 'os';
87

98
import { DebuggerEnvironmentVariable, execute } from '@cmt/proc';
109
import rollbar from '@cmt/rollbar';
@@ -704,6 +703,10 @@ export function isWorkspaceFolder(x?: any): boolean {
704703

705704
export async function normalizeAndVerifySourceDir(sourceDir: string): Promise<string> {
706705
let result = lightNormalizePath(sourceDir);
706+
if (process.platform === 'win32' && result.length > 1 && result.charCodeAt(0) > 97 && result.charCodeAt(0) <= 122 && result[1] === ':') {
707+
// Windows drive letter should be uppercase, for consistency with other tools like Visual Studio.
708+
result = result[0].toUpperCase() + result.slice(1);
709+
}
707710
if (path.basename(result).toLocaleLowerCase() === "cmakelists.txt") {
708711
// Don't fail if CMakeLists.txt was accidentally appended to the sourceDirectory.
709712
result = path.dirname(result);
@@ -767,7 +770,7 @@ export function isSupportedCompiler(compilerName: string | undefined): string |
767770
}
768771

769772
async function getHostSystemName(): Promise<string> {
770-
if (platform() === "win32") {
773+
if (process.platform === 'win32') {
771774
return "Windows";
772775
} else {
773776
const result = await execute('uname', ['-s']).result;

0 commit comments

Comments
 (0)