2021-04-20 10:28:11 +00:00
|
|
|
# PabstMirror - Overwrites all files in /include with updated version from a p-drive
|
|
|
|
|
|
|
|
import os
|
|
|
|
import shutil
|
|
|
|
|
2023-08-21 05:00:24 +00:00
|
|
|
include_base_path = os.path.join(os.path.dirname(os.path.dirname(os.path.realpath(__file__))), "include")
|
2021-04-20 10:28:11 +00:00
|
|
|
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)
|
2023-08-21 05:00:24 +00:00
|
|
|
if (file_v_path.endswith(".p3d")):
|
|
|
|
print(f"ignoring p3d {file_v_path}")
|
|
|
|
continue
|
2021-04-20 10:28:11 +00:00
|
|
|
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)
|
2023-08-21 05:00:24 +00:00
|
|
|
print(f"copying {file_v_path}")
|