New BUILD item, claimed in #1548 (claim). Follow-up of #1576, which fixes the same bug in world_index.py; the two PRs touch different files.
Problem
tools/bvh_index.py, anim_index.py, gamedata_xml.py, gamedata_index.py and navmesh_decode.py each have a same_*_path(first, second) helper that compares os.path.normcase(os.path.realpath(...)) and falls back to os.path.samefile. normcase folds case only on Windows, and samefile needs both files to exist already. So on macOS's default APFS volume, which is case-insensitive, bvh_index.py in.rpf --out o/B.json --csv o/b.json was accepted and the CSV write replaced the JSON summary with no error. Reproduced on main with a 4 KiB zero file (no game files).
Fix
The first comparison in each helper now goes through _path_key: normcase(realpath(path)), then case folding and NFD normalization when the volume that will hold the path is case-insensitive (pathconf(_PC_CASE_SENSITIVE) on the nearest existing parent; macOS only). APFS also treats café and café as one name, so the normalization is included. Nothing changes on Windows, Linux or case-sensitive macOS volumes. The tools stay standalone and stdlib-only, so each one gets its own copy of the helper, as they already have of same_*_path.
Tests
- New
tests/test_report_path_case.py: runs each tool's own helper on new paths that differ only in case or accent form, plus an end-to-endbvh_index.pyrun. The expected result follows the temp volume (refused when it's case-insensitive, two reports when it's case-sensitive). It fails onmain(11 failures) and passes with this change. - Ran on macOS (Apple Silicon, Python 3.12.10, Node 25.6.1), on the default APFS volume and on a case-sensitive APFS disk image (
TMPDIRpointed at it). - Existing tests still pass:
test_bvh_index,test_anim_index,test_anim_index_rigs_write,test_gamedata_xml*,test_gamedata_index*,test_navmesh_decode,test_gamedata_graph*,test_gamedata_maps*,test_bad_input_errors,test_docs_links. python -m compileall -q make_game.py tools tests,python -I make_game.py --help,python -m unittest discover -s tests/semantic(OK),node --test tests/test_viewer_streaming.cjs(35 pass).- Not run: the
dotnetandruntime/CMake builds (no .NET SDK or Ninja on this Mac; this change touches neither). No GPU involved.
#1573 also edits these five files, but only their CSV lineterminator. It doesn't touch these lines, so the two shouldn't conflict.
AI-assisted (Claude Code); tested on a Mac.
🤖 Generated with Claude Code