Apply needed pboProject settings in make.py via Windows Registry (#8128)

This commit is contained in:
Björn Dahlgren 2021-02-27 02:55:01 +01:00 committed by GitHub
parent 50578a2463
commit d55529041a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -227,6 +227,17 @@ 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 mikero_windows_registry(path, access=winreg.KEY_READ):
try:
return winreg.OpenKey(winreg.HKEY_CURRENT_USER, r"Software\Mikero\{}".format(path), access=access)
except FileNotFoundError:
try:
return winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"Software\Mikero\{}".format(path), access=access)
except FileNotFoundError:
try:
return winreg.OpenKey(winreg.HKEY_CURRENT_USER, r"Software\Wow6432Node\Mikero\{}".format(path), access=access)
except FileNotFoundError:
return winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"Software\Wow6432Node\Mikero\{}".format(path), access=access)
def find_depbo_tools():
"""Use registry entries to find DePBO-based tools."""
@ -235,19 +246,7 @@ def find_depbo_tools():
for tool in requiredToolPaths:
try:
try:
k = winreg.OpenKey(winreg.HKEY_CURRENT_USER, r"Software\Mikero\{}".format(tool))
path = winreg.QueryValueEx(k, "exe")[0]
except FileNotFoundError:
try:
k = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"Software\Mikero\{}".format(tool))
path = winreg.QueryValueEx(k, "exe")[0]
except FileNotFoundError:
try:
k = winreg.OpenKey(winreg.HKEY_CURRENT_USER, r"Software\Wow6432Node\Mikero\{}".format(tool))
path = winreg.QueryValueEx(k, "exe")[0]
except FileNotFoundError:
k = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"Software\Wow6432Node\Mikero\{}".format(tool))
k = mikero_windows_registry(tool)
path = winreg.QueryValueEx(k, "exe")[0]
except FileNotFoundError:
print_error("Could not find {}".format(tool))
@ -264,6 +263,17 @@ def find_depbo_tools():
return requiredToolPaths
def pboproject_settings():
"""Use registry entries to configure needed pboproject settings."""
value_exclude = "thumbs.db,*.txt,*.h,*.dep,*.cpp,*.bak,*.png,*.log,*.pew,source,*.tga"
try:
k = mikero_windows_registry(r"pboProject\Settings", access=winreg.KEY_SET_VALUE)
winreg.SetValueEx(k, "m_exclude", 0, winreg.REG_SZ, value_exclude)
winreg.SetValueEx(k, "m_exclude2", 0, winreg.REG_SZ, value_exclude)
except:
raise Exception("BadDePBO", "pboProject not installed correctly, make sure to run it at least once")
def color(color):
"""Set the color. Works on Win32 and normal terminals."""
@ -1031,6 +1041,8 @@ See the make.cfg file for additional build options.
pboproject = depbo_tools["pboProject"]
rapifyTool = depbo_tools["rapify"]
makepboTool = depbo_tools["MakePbo"]
pboproject_settings()
except:
raise
print_error("Could not find dePBO tools. Download the needed tools from: https://dev.withsix.com/projects/mikero-pbodll/files")