ACE3/tools/updateIncludes.py
PabstMirror 9c25fea548
Tools - Update includes tools, ignore .hemttout in str validator (#9337)
Tools - update includes tools, ignore .hemttout in str validator
2023-08-21 00:00:24 -05:00

26 lines
972 B
Python

# PabstMirror - Overwrites all files in /include with updated version from a p-drive
import os
import shutil
include_base_path = os.path.join(os.path.dirname(os.path.dirname(os.path.realpath(__file__))), "include")
p_drive_path = "P:\\"
if not os.path.exists(p_drive_path):
raise Exception("No P-drive")
for root, _dirs, files in os.walk(include_base_path):
relative_path = os.path.relpath(root, include_base_path)
for file in files:
if file == "$PBOPREFIX$":
continue
file_r_path = os.path.join(include_base_path, relative_path, file)
file_v_path = os.path.join(p_drive_path, relative_path, file)
if (file_v_path.endswith(".p3d")):
print(f"ignoring p3d {file_v_path}")
continue
if not os.path.isfile(file_v_path):
raise Exception("Missing p-drive file {}".format(file_v_path))
shutil.copyfile(file_v_path, file_r_path)
print(f"copying {file_v_path}")