diff options
| author | ItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com> | 2026-11-22 13:17:01 -0500 |
|---|---|---|
| committer | ItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com> | 2026-11-22 13:17:01 -0500 |
| commit | cb6cd67a68d0050a8c8563d488b7d71ea148312a (patch) | |
| tree | 710aec94c8d94cd260a47c2a01b4ef7c0e893988 /tools/tex_headers.py | |
| parent | 0b09e24ba8a94a3b57c2943f61cfc18e61a7a073 (diff) | |
| parent | db188f6bfee1452c6310fea8b14546a33e24785a (diff) | |
Merge pull request #2680 from OpenCode
Diffstat (limited to 'tools/tex_headers.py')
| -rw-r--r-- | tools/tex_headers.py | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/tools/tex_headers.py b/tools/tex_headers.py index 994220f4f..ba556e0f7 100644 --- a/tools/tex_headers.py +++ b/tools/tex_headers.py | |||
| @@ -726,6 +726,21 @@ def same_output_path(first, second): | |||
| 726 | return False | 726 | return False |
| 727 | 727 | ||
| 728 | 728 | ||
| 729 | def input_files(carve, archs): | ||
| 730 | """Yield (kind, path) for every file the scan reads from the selected carve archives. | ||
| 731 | |||
| 732 | Each archive contributes its ``index.json`` manifest and the ``<offset>.bin`` streams next to it. | ||
| 733 | A report path only has to match one of these, not the carve folder argument itself. | ||
| 734 | """ | ||
| 735 | for arch in archs: | ||
| 736 | folder = os.path.join(carve, arch) | ||
| 737 | yield "manifest", os.path.join(folder, "index.json") | ||
| 738 | with os.scandir(folder) as entries: | ||
| 739 | for entry in entries: | ||
| 740 | if entry.is_file() and entry.name.lower().endswith(".bin"): | ||
| 741 | yield "blob", entry.path | ||
| 742 | |||
| 743 | |||
| 729 | def main(): | 744 | def main(): |
| 730 | ap = argparse.ArgumentParser() | 745 | ap = argparse.ArgumentParser() |
| 731 | ap.add_argument("carve") | 746 | ap.add_argument("carve") |
| @@ -744,10 +759,9 @@ def main(): | |||
| 744 | path = a.out or os.path.join(a.carve, "textures_index.json") | 759 | path = a.out or os.path.join(a.carve, "textures_index.json") |
| 745 | if os.path.isdir(path): | 760 | if os.path.isdir(path): |
| 746 | ap.error(f"{path} is a directory, not a .json file") | 761 | ap.error(f"{path} is a directory, not a .json file") |
| 747 | for arch in archs: | 762 | for kind, source in input_files(a.carve, archs): |
| 748 | manifest = os.path.join(a.carve, arch, "index.json") | 763 | if same_output_path(source, path): |
| 749 | if same_output_path(manifest, path): | 764 | ap.error(f"output would overwrite an input {kind}: {path}") |
| 750 | ap.error(f"output would overwrite an input manifest: {path}") | ||
| 751 | allt = [] | 765 | allt = [] |
| 752 | for arch in archs: | 766 | for arch in archs: |
| 753 | try: | 767 | try: |