bink_index: ask report_paths for the report-path guard

This commit is contained in:
Enea Cortese
2026-11-29 14:16:15 +01:00
parent 3535eb5c4b
commit 89e3293375

View File

@ -45,6 +45,7 @@ import tempfile
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):