file_system: GetTempPath and GetTempFileName resolve GAME:, G: and T: to the overlay scratch folder (OLD-10017) #1314

Closed
github-bot wants to merge 5 commits from gh-pr/1314/head into gh-pr/1314/base
Owner

@⁠ambroseautomation on GitHub · 2026-11-24 21:44 UTC · original
ambroseautomation:carry/old-10017-fs-temp-paths → main · +246 −0 · 2 files · 5 commits · closed without merging

Summary

Coordination item: OLD-10017 (carry-forward of old-pr/10017, preserving original author tedin7 across all 5 commits).

Problem & Root Cause

Console titles query temporary directories and create temporary files via GetTempPathW/A and GetTempFileNameW/A using GAME:, G:, and T: virtual drives. Previously these APIs were not shimmed in runtime/shims/file_system.cpp, so temporary paths were not routed to the overlay scratch directory.

Implementation

  • Adds GetTempPathW/A and GetTempFileNameW/A shims in runtime/shims/file_system.cpp, routing console temporary paths (GAME:, G:, T:) to the overlay scratch folder.
  • Preserves temporary directory components and Unicode temporary paths, rejects lossy ANSI conversions, and fixes GetTempPathA exact-capacity return value semantics.
  • Adds comprehensive unit tests in runtime/test/file_system_test.cpp.

Tests Run

Environment: Windows 11 Pro 64-bit, Visual Studio 18 Community (cl.exe x64, /std:c++20 /W4 /permissive- /utf-8).

  • file_system_test.exe (compiled with runtime/test/file_system_test.cpp, runtime/shims/file_system.cpp, runtime/shims/registry.cpp, advapi32.lib, /OPT:NOREF) — 533 check(s), 0 failure(s) (PASS)
  • .\scripts\build_runtime.ps1 -jobs 8 — PASS (runtime/build/gta6rt.exe built cleanly)
  • python -I scripts/check_no_game_data.py runtime/shims/file_system.cpp runtime/test/file_system_test.cpp — PASS

Disclosure

AI-assisted: yes (carry-forward, rebase onto current main, and local MSVC build/test verification; original implementation by tedin7).

**@⁠ambroseautomation** on GitHub · 2026-11-24 21:44 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1314) `ambroseautomation:carry/old-10017-fs-temp-paths` → `main` · +246 −0 · 2 files · 5 commits · closed without merging ## Summary Coordination item: `OLD-10017` (carry-forward of `old-pr/10017`, preserving original author `tedin7` across all 5 commits). ### Problem & Root Cause Console titles query temporary directories and create temporary files via `GetTempPathW/A` and `GetTempFileNameW/A` using `GAME:`, `G:`, and `T:` virtual drives. Previously these APIs were not shimmed in `runtime/shims/file_system.cpp`, so temporary paths were not routed to the overlay scratch directory. ### Implementation - Adds `GetTempPathW/A` and `GetTempFileNameW/A` shims in `runtime/shims/file_system.cpp`, routing console temporary paths (`GAME:`, `G:`, `T:`) to the overlay scratch folder. - Preserves temporary directory components and Unicode temporary paths, rejects lossy ANSI conversions, and fixes `GetTempPathA` exact-capacity return value semantics. - Adds comprehensive unit tests in `runtime/test/file_system_test.cpp`. ## Tests Run Environment: Windows 11 Pro 64-bit, Visual Studio 18 Community (`cl.exe` x64, `/std:c++20 /W4 /permissive- /utf-8`). - `file_system_test.exe` (compiled with `runtime/test/file_system_test.cpp`, `runtime/shims/file_system.cpp`, `runtime/shims/registry.cpp`, `advapi32.lib`, `/OPT:NOREF`) — **533 check(s), 0 failure(s)** (PASS) - `.\scripts\build_runtime.ps1 -jobs 8` — PASS (`runtime/build/gta6rt.exe` built cleanly) - `python -I scripts/check_no_game_data.py runtime/shims/file_system.cpp runtime/test/file_system_test.cpp` — PASS ## Disclosure AI-assisted: yes (carry-forward, rebase onto current `main`, and local MSVC build/test verification; original implementation by tedin7).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:47:05 +00:00
github-bot closed this pull request 2026-11-26 09:47:05 +00:00
Author
Owner

@⁠whoalin1 on GitHub · 2026-11-24 23:54 UTC · original

Verified on Windows host (AI-assisted review), head 574f8c7e, MSVC RelWithDebInfo Ninja build (full rebuild — origin/main moved during the session).

  • Rebuilt runtime cleanly; file_system_test.exe with user TEMP/TMP: 533 checks, 0 failures.
  • All new GetTempPath/GetTempFileName checks pass on this host, including the ones that need real coverage here: TMP/TEMP pointing at GAME:, G:, T:\ all resolve to <overlay>\.gta6rt-temp\; subdirectory preservation for both TMP-then-TEMP fallback; unique-name generation; missing-subdir → ERROR_PATH_NOT_FOUND without creating it; refused GAME:..\outside → ERROR_INVALID_NAME with zero scratch writes; host paths pass through.
  • The ANSI code-page edge cases actually executed (not skipped): GetTempPathA rejects an unrepresentable overlay path and GetTempFileNameA rejects unrepresentable output and removes the created file both PASS — the test's overlay component is unrepresentable in this host's CP_ACP, so ERROR_NO_UNICODE_TRANSLATION and the cleanup path are genuinely covered.
  • Heads-up for the merger: this and #1312 both insert a new block at the same spot in file_system.cpp (after set_file_attributes_a) and both extend FILE_API — expect a textual merge conflict between them; the changes themselves are orthogonal (volume queries vs temp path).

Verdict: LGTM.

**@⁠whoalin1** on GitHub · 2026-11-24 23:54 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1314#issuecomment-7147926791) Verified on Windows host (AI-assisted review), head 574f8c7e, MSVC RelWithDebInfo Ninja build (full rebuild — origin/main moved during the session). - Rebuilt runtime cleanly; `file_system_test.exe` with user TEMP/TMP: **533 checks, 0 failures**. - All new GetTempPath/GetTempFileName checks pass on this host, including the ones that need real coverage here: TMP/TEMP pointing at GAME:\, G:\, T:\ all resolve to `<overlay>\.gta6rt-temp\`; subdirectory preservation for both TMP-then-TEMP fallback; unique-name generation; missing-subdir → ERROR_PATH_NOT_FOUND without creating it; refused GAME:\..\outside → ERROR_INVALID_NAME with zero scratch writes; host paths pass through. - The ANSI code-page edge cases actually executed (not skipped): `GetTempPathA rejects an unrepresentable overlay path` and `GetTempFileNameA rejects unrepresentable output and removes the created file` both PASS — the test's overlay component is unrepresentable in this host's CP_ACP, so ERROR_NO_UNICODE_TRANSLATION and the cleanup path are genuinely covered. - Heads-up for the merger: this and #1312 both insert a new block at the same spot in file_system.cpp (after set_file_attributes_a) and both extend FILE_API — expect a textual merge conflict between them; the changes themselves are orthogonal (volume queries vs temp path). Verdict: LGTM.
Author
Owner

@⁠ambroseautomation on GitHub · 2026-11-25 12:47 UTC · original

Closing as a duplicate of earlier PR #766 (OLD-10017, opened 2026-11-24T13:35:16Z). Thanks @⁠MoonEyes for catching the overlap.

**@⁠ambroseautomation** on GitHub · 2026-11-25 12:47 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1314#issuecomment-7162852213) Closing as a duplicate of earlier PR #766 (OLD-10017, opened 2026-11-24T13:35:16Z). Thanks @⁠MoonEyes for catching the overlap.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.