From 7b85cd88985a892c6e2239763fb772cd8a86198c Mon Sep 17 00:00:00 2001 From: Enea Cortese <148778899+breachato@users.noreply.github.com> Date: Mon, 30 Nov 2026 19:50:28 +0100 Subject: [PATCH 1/2] text_tables: ask report_paths for the report-path guard --- tools/text_tables.py | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/tools/text_tables.py b/tools/text_tables.py index 1314b60adc..f2818778d5 100644 --- a/tools/text_tables.py +++ b/tools/text_tables.py @@ -61,6 +61,7 @@ from file_mode import published_mode # noqa: E402 from hashdict import joaat # noqa: E402 from psin_dialogue import speaker_rows # noqa: E402 +from report_paths import same_report_path # noqa: E402 RESOURCE_MAGIC = b"0DRP" RPF9_MAGIC = b"9FPR" @@ -284,7 +285,6 @@ def input_under(source: str, address: str): return gamedata_index.carved_stream(address, source) if not os.path.isfile(address): # a new file is written after the scan, so it was never read return None - from report_paths import same_report_path for root, _dirs, names in os.walk(source): # an unlistable folder fails the scan before anything is written for name in names: if same_report_path(address, os.path.join(root, name)): @@ -463,15 +463,6 @@ def _write_csv(path, fields, rows): return n -def _same_output_path(first: str, second: str) -> bool: - if os.path.normcase(os.path.realpath(first)) == os.path.normcase(os.path.realpath(second)): - return True - try: - return os.path.samefile(first, second) - except OSError: - return False - - def main(argv=None) -> int: ap = argparse.ArgumentParser(description=__doc__.splitlines()[0]) ap.add_argument("sources", nargs="+", help="rpf9_carve.py directory, .rpf archive, or resource files/dirs") @@ -487,7 +478,7 @@ def main(argv=None) -> int: outs = [path for _, path in out_flags] seen = [] for flag, p in out_flags: - if any(_same_output_path(p, prev) for prev in seen): + if any(same_report_path(p, prev) for prev in seen): ap.error("outputs must be distinct files") seen.append(p) parent = os.path.dirname(os.path.abspath(p)) @@ -501,7 +492,7 @@ def main(argv=None) -> int: ap.error("an output must not overwrite an input") for source in a.sources: index = os.path.join(source, "index.json") - if os.path.isdir(source) and os.path.isfile(index) and any(_same_output_path(index, o) for o in outs): + if os.path.isdir(source) and os.path.isfile(index) and any(same_report_path(index, o) for o in outs): ap.error(f"an output must not overwrite an input: {index}") if os.path.isdir(source): for flag, path in out_flags: From de374c417751b9127dee61511c4c3b047914a038 Mon Sep 17 00:00:00 2001 From: Enea Cortese <148778899+breachato@users.noreply.github.com> Date: Mon, 30 Nov 2026 19:50:30 +0100 Subject: [PATCH 2/2] tests: list text_tables in SHARED The reviewers' red test: with this entry on main, test_switched_tools_import_the_helper_and_define_no_copy fails with "'from report_paths import same_report_path' not found"; with this branch it passes. --- tests/test_report_paths.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_report_paths.py b/tests/test_report_paths.py index 5a22fe2cc5..6a34411b2b 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", "text_tables", "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.