diff --git a/CHANGELOG.md b/CHANGELOG.md index 35d842395..4271f276b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ Improvements: - Add a setting to disable reading `compile_commands.json`. [#2586](https://github.com/microsoft/vscode-cmake-tools/issues/2586) [@xiaoyun94](https://github.com/xiaoyun94) - Preset in CMakeUserPresets.json using "condition" does not appear in configure preset selection. [#2749](https://github.com/microsoft/vscode-cmake-tools/issues/2749) - Resolve workspace variables in `cmake-kits.json`. [#2737](https://github.com/microsoft/vscode-cmake-tools/issues/2737) +- 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) ## 1.12.27 Bug Fixes: diff --git a/src/util.ts b/src/util.ts index e7f1364ce..d91eaaf32 100644 --- a/src/util.ts +++ b/src/util.ts @@ -4,7 +4,6 @@ import * as fs from 'fs'; import * as path from 'path'; import * as vscode from 'vscode'; import * as nls from 'vscode-nls'; -import { platform } from 'os'; import { DebuggerEnvironmentVariable, execute } from '@cmt/proc'; import rollbar from '@cmt/rollbar'; @@ -704,6 +703,10 @@ export function isWorkspaceFolder(x?: any): boolean { export async function normalizeAndVerifySourceDir(sourceDir: string): Promise { let result = lightNormalizePath(sourceDir); + if (process.platform === 'win32' && result.length > 1 && result.charCodeAt(0) > 97 && result.charCodeAt(0) <= 122 && result[1] === ':') { + // Windows drive letter should be uppercase, for consistency with other tools like Visual Studio. + result = result[0].toUpperCase() + result.slice(1); + } if (path.basename(result).toLocaleLowerCase() === "cmakelists.txt") { // Don't fail if CMakeLists.txt was accidentally appended to the sourceDirectory. result = path.dirname(result); @@ -767,7 +770,7 @@ export function isSupportedCompiler(compilerName: string | undefined): string | } async function getHostSystemName(): Promise { - if (platform() === "win32") { + if (process.platform === 'win32') { return "Windows"; } else { const result = await execute('uname', ['-s']).result;