Save-path normalization — tri's isolated test config can produce a GetSaveDirectory() result like "C:\...\.tmpXYZ\Users\josef\Saved\C:\...\.tmpXYZ\mission-smoke\...\" where an absolute drive-letter path appears embedded mid-string. Windows CreateFile silently resolves the second drive prefix and SaveBin succeeds, but ParamArchiveLoad::LoadBin treats it as the literal path and fails to open the fil
| 36 | // |
| 37 | // No-op on a normal path (no embedded ':' past offset 2). |
| 38 | static RString NormalizeSavePath(RString name) |
| 39 | { |
| 40 | const char* s = (const char*)name; |
| 41 | if (!s) |
| 42 | return name; |
| 43 | int lastDriveAt = -1; |
| 44 | int len = (int)strlen(s); |
| 45 | // Start at index 2 — we expect the FIRST "X:" near the start, and |
| 46 | // we want to detect any EMBEDDED later occurrence. |
| 47 | for (int i = 2; i + 1 < len; i++) |
| 48 | { |
| 49 | if (s[i + 1] == ':' && ((s[i] >= 'A' && s[i] <= 'Z') || (s[i] >= 'a' && s[i] <= 'z'))) |
| 50 | lastDriveAt = i; |
| 51 | } |
| 52 | if (lastDriveAt <= 0) |
| 53 | return name; |
| 54 | return RString(s + lastDriveAt); |
| 55 | } |
| 56 | extern int IDS_SAVE_GAME; |
| 57 | extern int IDS_LOAD_GAME; |
| 58 | namespace Poseidon |