\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
def getBertosDirs():\r
"""\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
+ if key:\r
+ while True:\r
+ try:\r
+ item = EnumValue(key, index)[1]\r
+ items.append(item)\r
+ index += 1\r
+ except WindowsError:\r
+ break\r
return items
\ No newline at end of file