diff --git a/tests/test_report_paths.py b/tests/test_report_paths.py index 5a22fe2cc5..5d5876386b 100644 --- a/tests/test_report_paths.py +++ b/tests/test_report_paths.py @@ -22,8 +22,8 @@ # Tools that use report_paths and must not define their own copy again. SHARED = ("anim_index", "awc_manifest", "bink_index", "gamedata_index", "gamedata_xml", "gen_d3d12_stubs", - "glb_inspect", "meshlet_page", "navmesh_index", "rpf_probe", "tile_probe", "world_index", - "world_lights_paths", "world_names") + "glb_inspect", "meshlet_page", "navmesh_index", "restofworld_model_join", "rpf_probe", "tile_probe", + "world_index", "world_lights_paths", "world_names") # The one tool that still carries its own copy (an open pull request edits its call site). Do not add to this list: # import report_paths instead. LEGACY_COPIES = {"navmesh_decode"} diff --git a/tools/restofworld_model_join.py b/tools/restofworld_model_join.py index fc6796983d..52fb241850 100644 --- a/tools/restofworld_model_join.py +++ b/tools/restofworld_model_join.py @@ -46,6 +46,11 @@ import time import zlib +ROOT = os.path.dirname(os.path.abspath(__file__)) +if ROOT not in sys.path: + sys.path.insert(0, ROOT) +from report_paths import same_report_path # noqa: E402 + ZHDR = re.compile(rb"\x78[\x01\x5e\x9c\xda]|KB2[a-z]") SYS_BASE = 0x50000000 GFX_BASE = 0x60000000 @@ -1263,21 +1268,14 @@ def byte_count_arg(text): def _aliases_input(out_path, source_path): - if os.path.normcase(os.path.realpath(out_path)) == os.path.normcase(os.path.realpath(source_path)): + if same_report_path(out_path, source_path): return True - try: - if os.path.samefile(out_path, source_path): - return True - except OSError: - pass if os.path.isdir(source_path): index_path = os.path.join(source_path, "index.json") - if os.path.normcase(os.path.realpath(out_path)) == os.path.normcase(os.path.realpath(index_path)): + if same_report_path(out_path, index_path): return True if not os.path.isfile(out_path): return False - if os.path.isfile(index_path) and os.path.samefile(out_path, index_path): - return True src_root = os.path.normcase(os.path.abspath(source_path)) target = os.path.normcase(os.path.abspath(out_path)) if os.path.dirname(target) == src_root and target.endswith((".bin", ".bk2")):