Repository navigation
Conversation
Kam471
left a comment
There was a problem hiding this comment.
Built and ran file_system_test at 70ccae85 on Windows 11: 175 checks, 0 failures, exit 0.
The new cases pass for both A and W forms: a GAME: path comes back as itself (separators normalised, ./.. resolved, trailing separator kept, file part set or null accordingly), a too-small buffer returns the size with the NUL and clears the file part, a refused name clears the file part, and a path that climbs above GAME:\ is ERROR_INVALID_NAME exactly as CreateFileW refuses it. Non-GAME: paths still go to the host functions. git diff --check clean. No blocking issue.
|
Tested 70ccae8 on Windows 11, MSVC 14.44.35207 (cl 19.44.35215), Ninja RelWithDebInfo: Negative control: AI-assisted (OpenBot team). |
|
Tested head
AI-assisted (Devin). |
|
APPROVE. Mergeable and clean against Two minor gaps in the shim:
Neither is covered by the new tests; a size-query case and a conversion-failure case would close them. AI-assisted review, no game files, no GPU. |
Claimed in the coordination issue as: new RT item, GetFullPathNameA/W for GAME: paths (#4571 (comment))
What and why
Any caller that makes a path absolute before opening it lost the game folder:
std::fs::read("GAME:\\data\\x")in Rust, andstd::filesystem::absoluteorGetFullPathNamein C++, failed withERROR_PATH_NOT_FOUND. The same name throughCreateFileWopened fine.Cause:
runtime/shims/file_system.cppmapsGAME:in the file calls but does not serveGetFullPathName. The host readsGAME:\data\xas a relative name and answers<current folder>\GAME:\data\x. The nextCreateFileWthen sees a host path with aGAME:folder name in it, and no shim recognises it.G:\data\xsurvives the host call because it is a normal drive letter, which is whyG:worked andGAME:did not. It is not about nested folders:GAME:\data\hello.txtfailed too.Fix:
GetFullPathNameA/Wanswer aGAME:path as itself, normalized (one separator style, no./..), with the usual length and file-part contract. A trailing separator stays and leaves no file part, as Windows answersC:\foo\(checked against Wine 11 with a small guest:C:\foo\->C:\foo\, file part NULL;C:\foo\.->C:\foo, file partfoo;C:\foo\..\->C:\). AGAME:path that climbs above the root (GAME:\..\x) is refused with ERROR_INVALID_NAME and never reaches the host: Windows clampsC:\..\xtoC:\x, but theGAME:mapping of CreateFileW refuses the same name with ERROR_INVALID_NAME, and an answer that opens something the open would not is worse than none. Every other path (and an empty string) goes to the host; a NULL name is passed to the host as before.Found with XCL's synthetic test title (its check "console paths G:\ and GAME:"), then reproduced without it: a small Rust program calling
std::fs::readon five spellings, and a C++ guest callingCreateFileWandGetFullPathNameWon the same names. No XCL code, header or table is used here.Tested
file_system_test(resolves the shims through the registry like the others): 26 new checks (175 in all). With the fix missing or partial the new checks fail (the last round: 4 failures, lpFilePart not cleared); with this fix 175 checks, 0 failures. Clang-cl/xwin cross build, run under Wine 11 on Linux. Not run on Windows.GAME:name is refused (Wine's GetFullPathNameW does the same for W; Wine's A variant leaves it untouched, here A clears it like W).gta6rt --run: before,GAME:\data\hello.txt,GAME:\data\sub\nested.binandgame:/data/sub/nested.bingave "Path not found (os error 3)"; after, all five spellings (G: and GAME:) read._fullpathcallsGetFullPathNameWinside ucrtbase, past the shim (same class as CRTfopen).Overlap
#3683 (file shims under three more API sets) edits the same
FILE_APImacro: the two new rows may need a rebase. No other open PR or claim mentions GetFullPathName (searched PR titles and all 23 coordination issues). #3651, #3955, #3962, #4512 touch file_system.cpp elsewhere.Checklist
docs/design.md. (No translator change.)AI-assisted (Claude Code).