fix(build): escape the build folder in glob patterns (a work folder with [ ] found no lifted code) #1722

Merged
BrunoSilvestre00 merged 1 commit from fix/glob-escape-work-dir into main 2026-11-10 15:29:50 +00:00
BrunoSilvestre00 commented 2026-11-10 14:37:10 +00:00 (Migrated from github.com)

What

A build folder (--work, or the builder's Change for the build files) whose path contains [ or ] makes the lift fail. Example: D:\Ports\[NS2] Hookshot\work.

oot_patches: WARNING: the dynamic resolution branch was found 0 times
oot_patches: WARNING: the text speed block was found 0 times
...
@@error lift.py stopped (exit status 1): oot_patches: the output size places were found [0, 0, 0, 0, 0, 0, 0, 0] times, not once each (OUT_EDITS [0, 1, 2, 3, 4, 5, 6, 7]): the lifted C no longer has the text they match

The passes find the generated C with glob.glob(os.path.join(gen, "code_*.c")). glob reads the brackets in the folder's own path as a character class ([NS2] matches one of N, S, 2), so the pattern matches no file. Every text patch then reports "found 0 times", and the output size check stops the build. The lift itself is fine (100% translated).

Change

The folder part goes through glob.escape() in the five calls that build a pattern from gen: nx2/chunks.py, nx2/oot_native_resolution.py, nx2/oot_patches.py (2) and nx2/split_hot.py. The pathlib .glob() calls in nx2/test_default_point_size.py only take relative patterns, so they're unaffected.

Testing

Windows 11, make_game.py --nup ... --work "D:\Ports\[NS2] Hookshot\work" with the builder's v2.0.12 tools:

  • before: fails as above, on main d8f0513 and on the v2.0.12 tag alike;
  • after: the lift's passes find their sites again (oot_native_resolution: scene base scale (f_806702e0) in code_005.c, oot_patches: output size in code_008.c, ... the free and mouse cameras, text speed, dynamic resolution) and the build goes on to compiling.

🤖 Generated with Claude Code

## What A build folder (`--work`, or the builder's **Change** for the build files) whose path contains `[` or `]` makes the lift fail. Example: `D:\Ports\[NS2] Hookshot\work`. ``` oot_patches: WARNING: the dynamic resolution branch was found 0 times oot_patches: WARNING: the text speed block was found 0 times ... @@error lift.py stopped (exit status 1): oot_patches: the output size places were found [0, 0, 0, 0, 0, 0, 0, 0] times, not once each (OUT_EDITS [0, 1, 2, 3, 4, 5, 6, 7]): the lifted C no longer has the text they match ``` The passes find the generated C with `glob.glob(os.path.join(gen, "code_*.c"))`. `glob` reads the brackets in the folder's own path as a character class (`[NS2]` matches one of `N`, `S`, `2`), so the pattern matches no file. Every text patch then reports "found 0 times", and the output size check stops the build. The lift itself is fine (100% translated). ## Change The folder part goes through `glob.escape()` in the five calls that build a pattern from `gen`: `nx2/chunks.py`, `nx2/oot_native_resolution.py`, `nx2/oot_patches.py` (2) and `nx2/split_hot.py`. The `pathlib` `.glob()` calls in `nx2/test_default_point_size.py` only take relative patterns, so they're unaffected. ## Testing Windows 11, `make_game.py --nup ... --work "D:\Ports\[NS2] Hookshot\work"` with the builder's v2.0.12 tools: - before: fails as above, on `main` d8f0513 and on the v2.0.12 tag alike; - after: the lift's passes find their sites again (`oot_native_resolution: scene base scale (f_806702e0) in code_005.c`, `oot_patches: output size in code_008.c`, ... the free and mouse cameras, text speed, dynamic resolution) and the build goes on to compiling. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Commenting is not possible because the repository is archived.
No description provided.