From 89e329337522e16ed0036a1059369d9c8b805f25 Mon Sep 17 00:00:00 2001 From: Enea Cortese <148778899+breachato@users.noreply.github.com> Date: Sun, 29 Nov 2026 14:16:15 +0100 Subject: [PATCH 1/2] bink_index: ask report_paths for the report-path guard --- tools/bink_index.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/tools/bink_index.py b/tools/bink_index.py index 49cad26860..9db9a5ecd7 100644 --- a/tools/bink_index.py +++ b/tools/bink_index.py @@ -45,6 +45,7 @@ sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) from file_mode import published_mode # noqa: E402 from replace_retry import replace as replace_retry # noqa: E402 +from report_paths import same_report_path # noqa: E402 SIG = re.compile(rb"KB2[a-z]") HDR = 0x2C @@ -430,14 +431,7 @@ def is_rpf_archive(path): return len(header) >= 16 and header[1:4] == b"FPR" -def same_output_path(first, second): - """True when writing ``second`` would truncate ``first`` (same file, path or hard link).""" - 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 +same_output_path = same_report_path # True when writing the second would truncate the first def target_problem(path): From 3cd08cfc785c9471c58059acca66c016b668c0ce Mon Sep 17 00:00:00 2001 From: Enea Cortese <148778899+breachato@users.noreply.github.com> Date: Sun, 29 Nov 2026 18:59:49 +0100 Subject: [PATCH 2/2] tests: list bink_index 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 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/test_report_paths.py b/tests/test_report_paths.py index 46aa9da9fd..a6b85b5049 100644 --- a/tests/test_report_paths.py +++ b/tests/test_report_paths.py @@ -21,8 +21,9 @@ import report_paths # noqa: E402 # Tools that use report_paths and must not define their own copy again. -SHARED = ("anim_index", "awc_manifest", "gamedata_index", "gamedata_xml", "gen_d3d12_stubs", "glb_inspect", - "navmesh_index", "rpf_probe", "tile_probe", "world_index", "world_lights_paths", "world_names") +SHARED = ("anim_index", "awc_manifest", "bink_index", "gamedata_index", "gamedata_xml", "gen_d3d12_stubs", + "glb_inspect", "navmesh_index", "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"}