From: duplo Date: Mon, 20 Apr 2009 18:00:03 +0000 (+0000) Subject: git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2592 38d2e660-2303-0410-9eaa... X-Git-Tag: 2.1.0~90 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=308f4a322d0062286df65f9791e6e5ad10940387;p=bertos.git git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2592 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/wizard/winreg_importer.py b/wizard/winreg_importer.py index 4e5131a9..4c75acb3 100644 --- a/wizard/winreg_importer.py +++ b/wizard/winreg_importer.py @@ -11,8 +11,16 @@ from _winreg import * -DIR_KEY = OpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\Develer\BeRTOS SDK\BeRTOS Dirs") -TOOLCHAIN_KEY = OpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\Develer\BeRTOS SDK\Toolchain Executables") +# Open the registry keys. When the keys don't exist it do nothing +try: + DIR_KEY = OpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\Develer\BeRTOS SDK\BeRTOS Dirs") +except WindowsError: + DIR_KEY = None + +try: + TOOLCHAIN_KEY = OpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\Develer\BeRTOS SDK\Toolchain Executables") +except WindowsError: + TOOLCHAIN_KEY = None def getBertosDirs(): """ @@ -33,10 +41,12 @@ def getFromRegistry(key): """ index = 0 items = [] - while True: - try: - item = EnumValue(TOOLCHAIN_KEY, index)[1] - items.append(item) - except WindowsError: - break + if key: + while True: + try: + item = EnumValue(key, index)[1] + items.append(item) + index += 1 + except WindowsError: + break return items \ No newline at end of file