]> Git Repo - pico-vscode.git/commitdiff
version check fix
authorpaulober <[email protected]>
Thu, 6 Jul 2023 15:23:52 +0000 (17:23 +0200)
committerpaulober <[email protected]>
Thu, 6 Jul 2023 15:23:52 +0000 (17:23 +0200)
src/commands/newProject.mts
src/extension.mts

index 90ddda4fd11a222e02651072512e9be3af684105..7648f1537a2d45a003268098810f67922abb7dd1 100644 (file)
@@ -194,7 +194,7 @@ export default class NewProjectCommand extends Command {
       this._settings
     )) ?? [];*/
     const installedSDKs = detectInstalledSDKs().sort((a, b) =>
-      compare(a.version, b.version)
+      compare(a.version.replace("v", ""), b.version.replace("v", ""))
     );
 
     if (
index 699da9d76545538489972d92656a1c79632e4ffb..941e7502239c60acc7cd43fec539620ee21881ca 100644 (file)
@@ -72,54 +72,53 @@ export async function activate(context: ExtensionContext): Promise<void> {
     context.subscriptions.push(command.register());
   });
 
-  // check selected SDK version
-  const sdkVersion = settings.getString(SettingsKey.picoSDK);
-  const sdkPath = await getSDKAndToolchainPath(settings);
-  const customSDKPath =
-    settings.getString(SettingsKey.picoSDKPath) || undefined;
-  const customToolchainPath =
-    settings.getString(SettingsKey.toolchainPath) || undefined;
+  if (workspace.workspaceFolders && workspace.workspaceFolders.length > 0) {
+    // check selected SDK version
+    const sdkVersion = settings.getString(SettingsKey.picoSDK);
+    const sdkPath = await getSDKAndToolchainPath(settings);
+    const customSDKPath =
+      settings.getString(SettingsKey.picoSDKPath) || undefined;
+    const customToolchainPath =
+      settings.getString(SettingsKey.toolchainPath) || undefined;
+
+    if (
+      // a SDK version is selected
+      sdkVersion &&
+      sdkPath &&
+      // only one path is custom
+      (customSDKPath === undefined || customToolchainPath === undefined)
+    ) {
+      setPicoSDKPath(sdkPath[0]);
+      setToolchainPath(sdkPath[1]);
 
-  if (
-    // a SDK version is selected
-    sdkVersion &&
-    sdkPath &&
-    // only one path is custom
-    (customSDKPath === undefined || customToolchainPath === undefined)
-  ) {
-    setPicoSDKPath(sdkPath[0]);
-    setToolchainPath(sdkPath[1]);
-    if (workspace.workspaceFolders && workspace.workspaceFolders.length > 0) {
       await updateVSCodeStaticConfigs(
         workspace.workspaceFolders[0].uri.fsPath,
         sdkPath[0],
         sdkPath[1]
       );
-    }
 
-    ui.updateSDKVersion(
-      sdkVersion +
-        // if one custom path is set then the picoSDK is only partly replaced/modifed
-        (customSDKPath !== undefined || customToolchainPath !== undefined
-          ? " [MODIFIED]"
-          : "")
-    );
-  } else {
-    // both paths are custom, show "custom"
-    if (sdkPath !== undefined) {
-      setPicoSDKPath(sdkPath[0]);
-      setToolchainPath(sdkPath[1]);
-      if (workspace.workspaceFolders && workspace.workspaceFolders.length > 0) {
+      ui.updateSDKVersion(
+        sdkVersion +
+          // if one custom path is set then the picoSDK is only partly replaced/modifed
+          (customSDKPath !== undefined || customToolchainPath !== undefined
+            ? " [MODIFIED]"
+            : "")
+      );
+    } else {
+      // both paths are custom, show "custom"
+      if (sdkPath !== undefined) {
+        setPicoSDKPath(sdkPath[0]);
+        setToolchainPath(sdkPath[1]);
         await updateVSCodeStaticConfigs(
           workspace.workspaceFolders[0].uri.fsPath,
           sdkPath[0],
           sdkPath[1]
         );
+        ui.updateSDKVersion("custom");
+      } else {
+        // could not find SDK && toolchain
+        ui.updateSDKVersion("N/A");
       }
-      ui.updateSDKVersion("custom");
-    } else {
-      // could not find SDK && toolchain
-      ui.updateSDKVersion("N/A");
     }
   }
 }
This page took 0.032616 seconds and 4 git commands to generate.