Skip to content

Refuse to write a mod whose long file paths would crash at runtime - #143

Merged
OruizGl merged 1 commit into
ootrando:nightlyfrom
deanrather:pr/long-path-warning
Nov 26, 2026
Merged

OruizGl merged 1 commit into
ootrando:nightlyfrom
deanrather:pr/long-path-warning

Conversation

@deanrather

Copy link
Copy Markdown
Contributor

When the mods folder sits deep on disk, some emulators and Windows cannot open OOTRR's longest file names, and the game aborts on entering a map that needs one (seen entering Goron City and Gerudo Fortress). The build now stops before replacing the mod, names the longest path, and asks to move the mods folder nearer the drive root.

Cause

Programs that keep a host path in a fixed 260-unit buffer (MAX_PATH) cut longer paths short. OOTRR's longest written name is 98 characters below romfs, so a mods folder path of about 160 characters is enough. Nothing in the build checked it.

Change

  • New long_paths module in ootrr-game: maps each staged file to its final absolute path and counts those of 260 UTF-16 units or more, with the longest.
  • Pack::commit checks before moving the staged mod into place. If any path is too long it removes the staging folder and returns an error with the count, the longest path, its length and the advice. The earlier mod stays. The command line exits non-zero, and the web page shows the error.
  • Default output is unchanged: builds with every path under 260 units commit exactly as before. Files added after the commit (cosmetics, title logo, update files) are not counted.

Checked

  • long_paths::tests: 259 units passes. 260 and 262 are found, count 2, longest 262.
  • modpack::tests::a_build_with_a_too_long_path_leaves_the_old_mod: 259 commits. 260 is refused and the earlier mod is kept.
  • cargo test --workspace: 2431 passed, 0 failed.
  • Not played. The abort it guards against was reproduced in the game with a long mods folder path, and does not occur with the same mod under a short one.

When the mods folder sits deep on disk, some emulators and Windows cannot open OOTRR's longest file names, and the game aborts on entering a map that needs one (seen entering Goron City and Gerudo Fortress). The build now stops before replacing the mod, names the longest path, and asks to move the mods folder nearer the drive root.

## Cause

Programs that keep a host path in a fixed 260-unit buffer (`MAX_PATH`) cut longer paths short. OOTRR's longest written name is 98 characters below `romfs`, so a mods folder path of about 160 characters is enough. Nothing in the build checked it.

## Change

- New `long_paths` module in `ootrr-game`: maps each staged file to its final absolute path and counts those of 260 UTF-16 units or more, with the longest.
- `Pack::commit` checks before moving the staged mod into place. If any path is too long it removes the staging folder and returns an error with the count, the longest path, its length and the advice. The earlier mod stays. The command line exits non-zero, and the web page shows the error.
- Default output is unchanged: builds with every path under 260 units commit exactly as before. Files added after the commit (cosmetics, title logo, update files) are not counted.

## Checked

- `long_paths::tests`: 259 units passes. 260 and 262 are found, count 2, longest 262.
- `modpack::tests::a_build_with_a_too_long_path_leaves_the_old_mod`: 259 commits. 260 is refused and the earlier mod is kept.
- `cargo test --workspace`: 2431 passed, 0 failed.
- Not played. The abort it guards against was reproduced in the game with a long mods folder path, and does not occur with the same mod under a short one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@OruizGl
OruizGl merged commit 86c07bc into ootrando:nightly Nov 26, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants