diff --git a/src/utils/cmakeUtil.mts b/src/utils/cmakeUtil.mts index c78cce2..45e2100 100644 --- a/src/utils/cmakeUtil.mts +++ b/src/utils/cmakeUtil.mts @@ -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 "# ====================================================================================" ); diff --git a/src/utils/download.mts b/src/utils/download.mts index fdffed5..2eeca56 100644 --- a/src/utils/download.mts +++ b/src/utils/download.mts @@ -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 { @@ -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);