diff --git a/tests/test_report_paths.py b/tests/test_report_paths.py index 5a22fe2cc5..ab920c1831 100644 --- a/tests/test_report_paths.py +++ b/tests/test_report_paths.py @@ -22,7 +22,7 @@ # 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", + "glb_inspect", "meshlet_page", "navmesh_index", "rpf_probe", "rtti_scan", "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. diff --git a/tools/rtti_scan.py b/tools/rtti_scan.py index a108f6fbae..207c4ba5ec 100644 --- a/tools/rtti_scan.py +++ b/tools/rtti_scan.py @@ -24,6 +24,7 @@ sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) from file_mode import published_mode # noqa: E402 +from report_paths import same_report_path # noqa: E402 @@ -519,12 +520,7 @@ def main(): print(f"ERROR: {a.image}: does not exist", file=sys.stderr) return 2 path = a.out or re.sub(r"\.(exe|dll)$", "", a.image, flags=re.I) + ".rtti.json" - same_path = os.path.normcase(os.path.realpath(a.image)) == os.path.normcase(os.path.realpath(path)) - try: - same_path = same_path or os.path.samefile(a.image, path) - except OSError: - pass # A missing or inaccessible path is handled by the normal read/write error path. - if same_path: + if same_report_path(a.image, path): ap.error("output must not overwrite the source image") try: with open(a.image, "rb") as f: