Correct typo
[bertos.git] / wizard / winreg_importer.py
index 4e5131a9e1a120cb18194d1dec812d476fa650f0..a9f5f8a7c0bf23dea8f7cefbd302824878e8b7a5 100644 (file)
 \r
 from _winreg import *\r
 \r
 \r
 from _winreg import *\r
 \r
-DIR_KEY = OpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\Develer\BeRTOS SDK\BeRTOS Dirs")\r
-TOOLCHAIN_KEY = OpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\Develer\BeRTOS SDK\Toolchain Executables")\r
+# Open the registry keys. When the keys don't exist it do nothing\r
+try:\r
+    DIR_KEY = OpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\Develer\BeRTOS SDK\BeRTOS Dirs")\r
+except WindowsError:\r
+    DIR_KEY = None\r
+\r
+try:\r
+    TOOLCHAIN_KEY = OpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\Develer\BeRTOS SDK\Toolchain Executables")\r
+except WindowsError:\r
+    TOOLCHAIN_KEY = None\r
+\r
+try:\r
+    CLI_KEY = OpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\Develer\BeRTOS SDK\Ide Command Lines")\r
+except WindowsError:\r
+    CLI_KEY = None\r
 \r
 def getBertosDirs():\r
     """\r
     Returns the path of the BeRTOS versions installed by the BeRTOS SDK installer.\r
     """\r
 \r
 def getBertosDirs():\r
     """\r
     Returns the path of the BeRTOS versions installed by the BeRTOS SDK installer.\r
     """\r
-    return getFromRegistry(DIR_KEY)\r
+    return getFromRegistry(DIR_KEY).values()\r
 \r
 \r
-def getBertosToolchain():\r
+def getBertosToolchains():\r
     """\r
     Returns the path of the executables of the toolchains installed by the BeRTOS\r
     SDK installer.\r
     """\r
     """\r
     Returns the path of the executables of the toolchains installed by the BeRTOS\r
     SDK installer.\r
     """\r
-    return getFromRegistry(TOOLCHAIN_KEY)\r
+    return getFromRegistry(TOOLCHAIN_KEY).values()\r
+\r
+def getCommandLines():\r
+    """\r
+    Returns the command lines to launch in order to open the selected IDE.\r
+    """\r
+    return getFromRegistry(CLI_KEY)\r
 \r
 def getFromRegistry(key):\r
     """\r
     Returns the value of all the named values of the given key.\r
     """\r
     index = 0\r
 \r
 def getFromRegistry(key):\r
     """\r
     Returns the value of all the named values of the given key.\r
     """\r
     index = 0\r
-    items = []\r
-    while True:\r
-        try:\r
-            item = EnumValue(TOOLCHAIN_KEY, index)[1]\r
-            items.append(item)\r
-        except WindowsError:\r
-            break\r
+    items = {}\r
+    if key:\r
+        while True:\r
+            try:\r
+                item = EnumValue(key, index)\r
+                items[item[0]] = item[1]\r
+                index += 1\r
+            except WindowsError:\r
+                break\r
     return items
\ No newline at end of file
     return items
\ No newline at end of file