@@ -445,10 +445,7 @@ export async function activate(context: ExtensionContext): Promise<void> {
445445
446446 return ;
447447 } else {
448- Logger . debug (
449- LoggerSource . extension ,
450- "Successfully downloaded and installed picotool."
451- ) ;
448+ Logger . debug ( LoggerSource . extension , "Found/installed picotool." ) ;
452449 }
453450 }
454451 ) ;
@@ -489,12 +486,11 @@ export async function activate(context: ExtensionContext): Promise<void> {
489486 "Failed to download and install OpenOCD."
490487 ) ;
491488 } else {
492- Logger . debug (
493- LoggerSource . extension ,
494- "Successfully downloaded and installed OpenOCD."
495- ) ;
489+ Logger . debug ( LoggerSource . extension , "Found/installed OpenOCD." ) ;
496490
497- void window . showInformationMessage ( "OpenOCD installed successfully." ) ;
491+ void window . showInformationMessage (
492+ "OpenOCD found/installed successfully."
493+ ) ;
498494 }
499495 }
500496 ) ;
@@ -503,7 +499,7 @@ export async function activate(context: ExtensionContext): Promise<void> {
503499 const ninjaPath = settings . getString ( SettingsKey . ninjaPath ) ;
504500 if ( ninjaPath && ninjaPath . includes ( "/.pico-sdk/ninja" ) ) {
505501 // check if ninja path exists
506- if ( ! existsSync ( ninjaPath . replace ( HOME_VAR , homedir ( ) ) ) ) {
502+ if ( ! existsSync ( ensureExe ( ninjaPath . replace ( HOME_VAR , homedir ( ) ) ) ) ) {
507503 Logger . debug (
508504 LoggerSource . extension ,
509505 "Ninja path in settings does not exist." ,
@@ -571,7 +567,7 @@ export async function activate(context: ExtensionContext): Promise<void> {
571567 const cmakePath = settings . getString ( SettingsKey . cmakePath ) ;
572568 if ( cmakePath && cmakePath . includes ( "/.pico-sdk/cmake" ) ) {
573569 // check if cmake path exists
574- if ( ! existsSync ( cmakePath . replace ( HOME_VAR , homedir ( ) ) ) ) {
570+ if ( ! existsSync ( ensureExe ( cmakePath . replace ( HOME_VAR , homedir ( ) ) ) ) ) {
575571 Logger . warn (
576572 LoggerSource . extension ,
577573 "CMake path in settings does not exist." ,
@@ -775,6 +771,20 @@ export async function activate(context: ExtensionContext): Promise<void> {
775771 }
776772}
777773
774+ /**
775+ * Make sure the executable has the .exe extension on Windows.
776+ *
777+ * @param inp - The input string.
778+ * @returns The input string with .exe extension if on Windows.
779+ */
780+ function ensureExe ( inp : string ) : string {
781+ return process . platform === "win32"
782+ ? inp . endsWith ( ".exe" )
783+ ? inp
784+ : `${ inp } .exe`
785+ : inp ;
786+ }
787+
778788export function deactivate ( ) : void {
779789 // TODO: maybe await
780790 void commands . executeCommand ( "setContext" , ContextKeys . isPicoProject , true ) ;
0 commit comments