Skip to content

Commit 6ad3a36

Browse files
committed
Fix gitPath issue on first run (Windows)
Signed-off-by: paulober <[email protected]>
1 parent 95db93b commit 6ad3a36

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

src/utils/cmakeUtil.mts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const CMAKE_DO_NOT_EDIT_HEADER_PREFIX =
1717
// eslint-disable-next-line max-len
1818
"== DO NOT EDIT THE FOLLOWING LINES for the Raspberry Pi Pico VS Code Extension to work ==";
1919
export const CMAKE_DO_NOT_EDIT_HEADER_PREFIX_OLD =
20-
// eslint-disable-next-line max-len
20+
// eslint-disable-next-line max-len
2121
"== DO NEVER EDIT THE NEXT LINES for Raspberry Pi Pico VS Code Extension to work ==";
2222

2323
export async function getPythonPath(): Promise<string> {
@@ -111,7 +111,7 @@ export async function configureCmakeNinja(
111111

112112
Logger.error(LoggerSource.cmake, errorMsg);
113113

114-
await window.showErrorMessage(
114+
void window.showErrorMessage(
115115
"Failed to configure cmake for the current project. " + errorMsg
116116
);
117117

@@ -127,7 +127,6 @@ export async function configureCmakeNinja(
127127

128128
if (existsSync(join(folder.fsPath, "build", "CMakeCache.txt"))) {
129129
// check if the build directory has been moved
130-
131130
const buildDir = join(folder.fsPath, "build");
132131

133132
const cacheBuildDir = cmakeGetPicoVar(
@@ -203,8 +202,9 @@ export async function configureCmakeNinja(
203202
pythonPath.includes("/")
204203
? `-DPython3_EXECUTABLE="${pythonPath.replaceAll("\\", "/")}" `
205204
: ""
206-
}` + `-G Ninja -B ./build "${folder.fsPath}"`
207-
+ (buildType ? ` -DCMAKE_BUILD_TYPE=${buildType}` : "");
205+
}` +
206+
`-G Ninja -B ./build "${folder.fsPath}"` +
207+
(buildType ? ` -DCMAKE_BUILD_TYPE=${buildType}` : "");
208208

209209
await new Promise<void>((resolve, reject) => {
210210
// use exec to be able to cancel the process
@@ -330,7 +330,7 @@ export async function cmakeUpdateSDK(
330330
// This regex requires multiline (m) and dotall (s) flags to work
331331
const updateSectionRegex = new RegExp(
332332
`^# (${CMAKE_DO_NOT_EDIT_HEADER_PREFIX}` +
333-
`|${CMAKE_DO_NOT_EDIT_HEADER_PREFIX_OLD}).*# =+$`,
333+
`|${CMAKE_DO_NOT_EDIT_HEADER_PREFIX_OLD}).*# =+$`,
334334
"ms"
335335
);
336336
const picoBoardRegex = /^set\(PICO_BOARD\s+([^)]+)\)$/m;
@@ -372,10 +372,8 @@ export async function cmakeUpdateSDK(
372372
// version is less than 2.0.0, or pico2_w and new version <2.1.0
373373
if (
374374
picoBoard !== null &&
375-
((picoBoard[1].includes("pico2") &&
376-
compareLt(newSDKVersion, "2.0.0")) ||
377-
(picoBoard[1].includes('pico2_w') &&
378-
compareLt(newSDKVersion, "2.1.0")))
375+
((picoBoard[1].includes("pico2") && compareLt(newSDKVersion, "2.0.0")) ||
376+
(picoBoard[1].includes("pico2_w") && compareLt(newSDKVersion, "2.1.0")))
379377
) {
380378
const quickPickItems = ["pico", "pico_w"];
381379
if (!compareLt(newSDKVersion, "2.0.0")) {

src/utils/gitUtil.mts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,10 @@ export async function ensureGit(
103103
if (downloadedGitPath) {
104104
await settings.updateGlobal(SettingsKey.gitPath, downloadedGitPath);
105105
isGitInstalled = true;
106-
gitPath = downloadedGitPath;
106+
gitPath = downloadedGitPath.replace(
107+
HOME_VAR,
108+
homedir().replaceAll("\\", "/")
109+
);
107110
} else if (gitVersion) {
108111
Logger.error(
109112
LoggerSource.gitUtil,

0 commit comments

Comments
 (0)