Skip to content

Commit

Permalink
Fix updating include path
Browse files Browse the repository at this point in the history
Use USERHOME, rather than a full path
  • Loading branch information
will-v-pi committed Aug 15, 2024
1 parent f4ef8ce commit 96dd2b4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/utils/cmakeUtil.mts
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ export async function cmakeUpdateSDK(
`set(sdkVersion ${newSDKVersion})\n` +
`set(toolchainVersion ${newToolchainVersion})\n` +
`set(picotoolVersion ${picotoolVersion})\n` +
`include(${buildCMakeIncPath()})\n` +
`include(${buildCMakeIncPath(false)})\n` +
// eslint-disable-next-line max-len
"# ===================================================================================="
);
Expand Down
18 changes: 14 additions & 4 deletions src/utils/download.mts
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,24 @@ export function buildSDKPath(version: string): string {
);
}

export function buildCMakeIncPath(): string {
export function buildCMakeIncPath(absolute: boolean): string {
// TODO: maybe replace . with _
return joinPosix(
homedir().replaceAll("\\", "/"),
const relPath = joinPosix(
".pico-sdk",
"cmake",
"pico-vscode.cmake"
);
if (absolute) {
return joinPosix(
homedir().replaceAll("\\", "/"),
relPath
);
} else {
return joinPosix(
"${USERHOME}",
relPath
);
}
}

export function buildToolsPath(version: string): string {
Expand Down Expand Up @@ -305,7 +315,7 @@ export async function downloadAndInstallSDK(
// Install pico-vscode.cmake file - overwrite if it's already there
copyFileSync(
joinPosix(getScriptsRoot(), "pico-vscode.cmake"),
buildCMakeIncPath()
buildCMakeIncPath(true)
);

const targetDirectory = buildSDKPath(version);
Expand Down

0 comments on commit 96dd2b4

Please sign in to comment.