Skip to content

fix(savegame): Load save games on non-Windows builds - #3236

Draft
bobtista wants to merge 1 commit into
TheSuperHackers:mainfrom
bobtista:bobtista/fix/savegame-load-non-windows
Draft

fix(savegame): Load save games on non-Windows builds#3236
bobtista wants to merge 1 commit into
TheSuperHackers:mainfrom
bobtista:bobtista/fix/savegame-load-non-windows

Conversation

@bobtista

@bobtista bobtista commented Aug 29, 2026

Copy link
Copy Markdown

GameState::portableMapPathToRealMapPath lowercases the real path it returns, and getSaveDirectory appends the mixed case Save component, so the two can never match on a case sensitive platform regardless of how the rest of the user data directory is spelled. GameState::isInSaveDirectory then compares that lowercased path with FileSystem::isPathInDirectory, which compares case insensitively only on Windows. On every other platform Save never matches save, GameStateMap::xfer throws on that check, and no save game can be loaded.

Before #1058 the check was path.startsWithNoCase(getSaveDirectory()). #1058 replaced it with the strict containment helper it added for a different purpose, and the case insensitivity was lost off Windows.

Now isInSaveDirectory lowercases both sides before delegating, so the comparison is case insensitive again while the path is still normalized. Windows behaviour is unchanged, the lowercased map name is unchanged, and every caller of isInSaveDirectory is fixed, including the restart path and the map name checks in GameLogic.

FileSystem::isPathInDirectory is deliberately left strict. #1058 added it to validate network supplied portable paths, and ConnectionManager::processFile opens the path it produces with CREATE | WRITE, so its result authorizes a file write and it should keep comparing case sensitively off Windows.

Todo:

  • A save game loads on a non-Windows build
  • FileSystem::isPathInDirectory is unchanged and still case sensitive off Windows
  • A save game loads from the in-game load menu on a non-Windows build
  • A save game still loads on a Windows build
  • Both games build (z_generals and g_generals)
  • A portable path that escapes its base directory is still rejected
  • Two directories differing only by case are still treated as different by FileSystem::isPathInDirectory

@bobtista
bobtista force-pushed the bobtista/fix/savegame-load-non-windows branch from 33aa7b2 to d0fa953 Compare August 29, 2026 02:39
@OmarAglan

Copy link
Copy Markdown

@codex

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: d0fa953f49

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Save games cannot be loaded on non-Windows builds

2 participants