Fix hardcoded backslash data-file paths for Linux (Train/Plane/TexRead/save code) #11

Open
opened 2026-11-29 00:15:08 +00:00 by opencode · 0 comments
Owner

Context

Linux filesystems treat \ as a literal character, not a path separator. Known hardcoded Windows-style literals (from structural scan of master):

  • src/vehicles/Train.cpp:429,433 — "data\\paths\\tracks.dat"
  • src/vehicles/Plane.cpp:661,742,748,754 — "data\\paths\\flight*.dat"
  • src/rw/TexRead.cpp:199,354,448 — "DATA\\CAPS.DAT", "models\\txd.img", "models\\txd.dir"
  • Save-path formatting with "%s\\%s": src/save/PCSave.cpp:22, src/save/MemoryCard.cpp (several), src/skel/glfw/glfw.cpp:160 ("\\GTA3 User Files")

src/skel/crossplatform.cpp:215-230 has path normalization helpers, but not all call sites route through them.

Task

Route every data-file literal through the crossplatform helpers (or #ifdef-free equivalents) so Linux builds resolve the same files as Windows. Check the miami branch for its own instances of the same pattern.

Acceptance

  • Grep for \\ path literals in src/ returns zero unresolved cases on both branches (or each remaining case is documented why it's Windows-only).
  • Verify no behavioral change on Windows (path helpers must be no-ops there).
  • Style: tabs, project typedefs, no new dependencies.
## Context Linux filesystems treat `\` as a literal character, not a path separator. Known hardcoded Windows-style literals (from structural scan of `master`): - `src/vehicles/Train.cpp:429,433` — `"data\\paths\\tracks.dat"` - `src/vehicles/Plane.cpp:661,742,748,754` — `"data\\paths\\flight*.dat"` - `src/rw/TexRead.cpp:199,354,448` — `"DATA\\CAPS.DAT"`, `"models\\txd.img"`, `"models\\txd.dir"` - Save-path formatting with `"%s\\%s"`: `src/save/PCSave.cpp:22`, `src/save/MemoryCard.cpp` (several), `src/skel/glfw/glfw.cpp:160` (`"\\GTA3 User Files"`) `src/skel/crossplatform.cpp:215-230` has path normalization helpers, but not all call sites route through them. ## Task Route every data-file literal through the crossplatform helpers (or `#ifdef`-free equivalents) so Linux builds resolve the same files as Windows. Check the `miami` branch for its own instances of the same pattern. ## Acceptance - Grep for `\\` path literals in `src/` returns zero unresolved cases on both branches (or each remaining case is documented why it's Windows-only). - Verify no behavioral change on Windows (path helpers must be no-ops there). - Style: tabs, project typedefs, no new dependencies.
opencode added this to the M2: Linux platform hardening milestone 2026-11-29 00:15:08 +00:00
opencode added the buglinux labels 2026-11-29 00:15:08 +00:00
Sign in to join this conversation.