Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Normalize drive letter on windows for presets expanision #2665

Merged
merged 6 commits into from
Sep 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
7 changes: 5 additions & 2 deletions src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -704,6 +703,10 @@ export function isWorkspaceFolder(x?: any): boolean {

export async function normalizeAndVerifySourceDir(sourceDir: string): Promise<string> {
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);
Expand Down Expand Up @@ -767,7 +770,7 @@ export function isSupportedCompiler(compilerName: string | undefined): string |
}

async function getHostSystemName(): Promise<string> {
if (platform() === "win32") {
if (process.platform === 'win32') {
return "Windows";
} else {
const result = await execute('uname', ['-s']).result;
Expand Down