ACE3/tools/updateIncludes.py

26 lines
972 B
Python
Raw Normal View History

# 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}")