fix: a game folder whose deepest file passes 260 characters builds and plays (#1468) #1497
No reviewers
Labels
No labels
accessibility
autorelease: pending
autorelease: tagged
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
question
testing wanted
wontfix
No milestone
No assignees
1 participant
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Hookshot!1497
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/long-paths"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #1468: in a deeply nested folder, the unpack stopped with
FileNotFoundErroron a 262-character path inromfs\Event\EventSetting. Windows' 260-character limit (MAX_PATH) applies unless the program uses extended-length paths or the system's long-paths setting is on, and that setting is off by default.Builder (Python): the unpack, the damaged-file scan and stand-ins, the romfs links into the game folder and the shader list step use extended-length paths (
\?\...) on Windows.nup.long_path()andmake_game.long_path()do nothing elsewhere. The scan still returns paths in the form it was given, so callers and tests see no change.Game (
host/nn_fs.c): path buffers go from 260 to 1024 bytes. Each file call (CreateFile, GetFileAttributes, Find*, CreateDirectory, Delete, Move, RemoveDirectory) goes through its wide function. The path is converted with the process code page (UTF-8 under the game's manifest), and a long absolute path gets the extended prefix. Short paths behave exactly as before.Tested:
test_make_game_cache,test_nup_stand_in,test_nup_verify,test_finish_outputandtest_shader_census_cmdpass. The last now expects the long form on Windows.nn_fs.cis clean with-Wall -Wextra.🤖 Generated with Claude Code
Looks good. The wide-API wrappers in nn_fs.c are a clean way to get long paths without touching every call site, the 1024-byte buffers leave room for the \?\ prefix, and the Python side returns paths in the form it was given so callers don't change. CI is green, including Windows.
Nits only:
..,.or doubled backslash in a host path longer than 240 chars would fail where a short one works. I didn't see host_path produce those, so just worth knowing.#1516 also fixes long paths (#1468), so one of the two should land and the other be closed or rebased.