Repository navigation
Refuse to write a mod whose long file paths would crash at runtime - #143
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 belowromfs, so a mods folder path of about 160 characters is enough. Nothing in the build checked it.Change
long_pathsmodule inootrr-game: maps each staged file to its final absolute path and counts those of 260 UTF-16 units or more, with the longest.Pack::commitchecks 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.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.