@@ -6,6 +6,7 @@ import { type WorkspaceConfiguration, workspace } from "vscode";
66import { dirname } from "path/posix" ;
77import { compareGe } from "./semverUtil.mjs" ;
88import { extensionName } from "../commands/command.mjs" ;
9+ import { EOL } from "os" ;
910
1011interface Configuration {
1112 includePath : string [ ] ;
@@ -58,11 +59,12 @@ async function updateCppPropertiesFile(
5859 ? "riscv32-corev-elf-gcc"
5960 : "riscv32-unknown-elf-gcc"
6061 : "arm-none-eabi-gcc"
61- } `;
62+ } ${ config . compilerPath . endsWith ( ".exe" ) ? ".exe" : "" } `;
6263 } ) ;
6364
6465 // Write the updated JSON back to the file
65- const updatedJsonData = JSON . stringify ( cppProperties , null , 4 ) ;
66+ const updatedJsonData =
67+ ( JSON . stringify ( cppProperties , null , 4 ) + EOL ) . replace ( / \r ? \n / g, EOL ) ;
6668 await writeFile ( file , updatedJsonData , "utf8" ) ;
6769
6870 console . log ( "cpp_properties.json file updated successfully." ) ;
@@ -148,6 +150,7 @@ async function updateSettingsFile(
148150 Logger . debug ( LoggerSource . vscodeConfigUtil , `Oldpath: ${ oldPath } ` ) ;
149151 const pathList = oldPath . split ( key . includes ( "windows" ) ? ";" : ":" ) ;
150152 let toolchainIdx = - 1 ;
153+ let picotoolIdx = - 1 ;
151154 let cmakeIdx = - 1 ;
152155 let ninjaIdx = - 1 ;
153156
@@ -158,6 +161,9 @@ async function updateSettingsFile(
158161 if ( item . includes ( ".pico-sdk/toolchain" ) ) {
159162 toolchainIdx = i ;
160163 }
164+ if ( item . includes ( ".pico-sdk/picotool" ) ) {
165+ picotoolIdx = i ;
166+ }
161167 if ( item . includes ( ".pico-sdk/cmake" ) ) {
162168 cmakeIdx = i ;
163169 }
@@ -173,6 +179,17 @@ async function updateSettingsFile(
173179
174180 pathList [ toolchainIdx ] = currentValue [ "PICO_TOOLCHAIN_PATH" ] + "/bin" ;
175181
182+ if ( newSDKVersion ) {
183+ const newPicotoolPath = `\${${
184+ key . includes ( "windows" ) ? "env:USERPROFILE" : "env:HOME"
185+ } }/.pico-sdk/picotool/${ newSDKVersion } /picotool`;
186+ if ( picotoolIdx > 0 ) {
187+ pathList [ picotoolIdx ] = newPicotoolPath ;
188+ } else {
189+ pathList . splice ( pathList . length - 1 , 0 , newPicotoolPath ) ;
190+ }
191+ }
192+
176193 if ( newCMakeVersion && newCMakeVersion !== "cmake" ) {
177194 let newCmakePath = "" ;
178195 if ( ! newCMakeVersion . includes ( "/" ) ) {
0 commit comments