Fix Mikero tools dupe key issue (#5853)

Mikero tools seams to not cleanup regkeys properly and leaves a key with no value behind making. Making find_depbo_tools break
This commit is contained in:
Daniel Jupp 2017-12-04 13:15:24 -06:00 committed by jonpas
parent bbda53ca1a
commit 5a4c439c22

View File

@ -235,17 +235,19 @@ def find_depbo_tools():
for tool in requiredToolPaths:
try:
k = winreg.OpenKey(winreg.HKEY_CURRENT_USER, r"Software\Mikero\{}".format(tool))
try:
k = winreg.OpenKey(winreg.HKEY_CURRENT_USER, r"Software\Mikero\{}".format(tool))
path = winreg.QueryValueEx(k, "exe")[0]
except FileNotFoundError:
k = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"Software\Mikero\{}".format(tool))
path = winreg.QueryValueEx(k, "exe")[0]
except FileNotFoundError:
k = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"Software\Mikero\{}".format(tool))
try:
path = winreg.QueryValueEx(k, "exe")[0]
print_error("Could not find {}".format(tool))
failed = True
else:
#Strip any quotations from the path due to a MikeRo tool bug which leaves a trailing space in some of its registry paths.
requiredToolPaths[tool] = path.strip('"')
print_green("Found {}.".format(tool))
except:
print_error("Could not find {}".format(tool))
failed = True
finally:
winreg.CloseKey(k)