From: duplo Date: Mon, 20 Apr 2009 17:33:07 +0000 (+0000) Subject: Add generic function for retrieve information from the registry X-Git-Tag: 2.1.0~91 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=a8fcfb6e93a2bd82ece8953a282c7e28914a646d;p=bertos.git Add generic function for retrieve information from the registry git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2591 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/wizard/winreg_importer.py b/wizard/winreg_importer.py index 714d0a78..4e5131a9 100644 --- a/wizard/winreg_importer.py +++ b/wizard/winreg_importer.py @@ -12,16 +12,31 @@ 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") def getBertosDirs(): + """ + Returns the path of the BeRTOS versions installed by the BeRTOS SDK installer. + """ + return getFromRegistry(DIR_KEY) + +def getBertosToolchain(): + """ + Returns the path of the executables of the toolchains installed by the BeRTOS + SDK installer. + """ + return getFromRegistry(TOOLCHAIN_KEY) + +def getFromRegistry(key): + """ + Returns the value of all the named values of the given key. + """ index = 0 - dirs = [] + items = [] while True: try: - dir = EnumValue(DIR_KEY, index)[1] - dirs.append(dir) - index += 1 + item = EnumValue(TOOLCHAIN_KEY, index)[1] + items.append(item) except WindowsError: break - return dirs - \ No newline at end of file + return items \ No newline at end of file