From ca1bafcc79c46bb1a1bcedbd711fded00947db09 Mon Sep 17 00:00:00 2001 From: ViperMaul Date: Tue, 7 Apr 2015 20:36:19 -0700 Subject: [PATCH] Improved usage of the registry for path to CfgConvert.exe and MikeRo Tools --- .../pabstFrankensteinBuilder.py | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/tools/ace_build_tool/pabstFrankensteinBuilder.py b/tools/ace_build_tool/pabstFrankensteinBuilder.py index 09b12a5dc3..f58f192a53 100644 --- a/tools/ace_build_tool/pabstFrankensteinBuilder.py +++ b/tools/ace_build_tool/pabstFrankensteinBuilder.py @@ -188,10 +188,16 @@ def find_bi_tools(work_drive): else: raise Exception("BadTools","Arma 3 Tools are not installed correctly or the P: drive needs to be created.") -def find_depbo_tools(): +def find_depbo_tools(regKey): """Use registry entries to find DePBO-based tools.""" + stop = False + + if regKey == "HKCU": + reg = winreg.ConnectRegistry(None, winreg.HKEY_CURRENT_USER) + stop = True + else: + reg = winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE) - reg = winreg.ConnectRegistry(None, winreg.HKEY_CURRENT_USER) try: k = winreg.OpenKey(reg, r"Software\Mikero\pboProject") try: @@ -217,7 +223,10 @@ def find_depbo_tools(): except: print_error("Could not find makepbo.") except: - raise Exception("BadDePBO", "DePBO tools not installed correctly") + if stop == True: + raise Exception("BadDePBO", "DePBO tools not installed correctly") + return -1 + #Strip any quotations from the path due to a MikeRo tool bug which leaves a trailing space in some of its registry paths. return [pboproject_path.strip('"'),rapify_path.strip('"'),makepbo_path.strip('"')] @@ -439,7 +448,9 @@ See the make.cfg file for additional build options. if build_tool == "pboproject": try: - depbo_tools = find_depbo_tools() + depbo_tools = find_depbo_tools("HKLM") + if depbo_tools == -1: + depbo_tools = find_depbo_tools("HKCU") pboproject = depbo_tools[0] rapifyTool = depbo_tools[1] makepboTool = depbo_tools[2] @@ -580,7 +591,7 @@ See the make.cfg file for additional build options. os.chdir("P:\\") - cmd = [os.path.join(work_drive, "CfgConvert", "CfgConvert.exe"), "-bin", "-dst", os.path.join(work_drive, prefix, module, "config.bin"), os.path.join(work_drive, prefix, module, "config.cpp")] + cmd = [os.path.join(arma3tools_path, "CfgConvert", "CfgConvert.exe"), "-bin", "-dst", os.path.join(work_drive, prefix, module, "config.bin"), os.path.join(work_drive, prefix, module, "config.cpp")] ret = subprocess.call(cmd) #ret = subprocess.call(["cfgConvertGUI.exe", os.path.join(work_drive, prefix, module, "config.cpp")]) @@ -589,7 +600,7 @@ See the make.cfg file for additional build options. input("Press Enter to continue...") - cmd = [os.path.join(work_drive, "CfgConvert", "CfgConvert.exe"), "-txt", "-dst", os.path.join(work_drive, prefix, module, "config.cpp"), os.path.join(work_drive, prefix, module, "config.bin")] + cmd = [os.path.join(arma3tools_path, "CfgConvert", "CfgConvert.exe"), "-txt", "-dst", os.path.join(work_drive, prefix, module, "config.cpp"), os.path.join(work_drive, prefix, module, "config.bin")] ret = subprocess.call(cmd) if ret != 0: print_error("CfgConvert -txt) return code == " + str(ret))