Skip to content

bugfix(map): Accept either path separator in map lookups - #3109

Draft
bobtista wants to merge 2 commits into
TheSuperHackers:mainfrom
bobtista:bobtista/bugfix/lan-map-resolution
Draft

bobtista wants to merge 2 commits into
TheSuperHackers:mainfrom
bobtista:bobtista/bugfix/lan-map-resolution

Conversation

@bobtista

@bobtista bobtista commented Aug 11, 2026 •

Copy link
Copy Markdown

Closes #3103

Map validation rejects a preferred map with different path separators and falls back to the default before LAN setup can resolve it.

Now validation uses findMap, and cache keys and lookups use native separators. LAN setup uses the resolved filename. Custom-match preferences also normalize separators for callers that still use exact lookups.

Reproduction:

  1. Select a non-default multiplayer map, then change its stored LAN preference to use the other separator or a mix of both.
  2. Host a LAN game.
  3. Check that the selected map is retained and the host has its availability, CRC, and size set.

Testing:

  • macOS integration probe: old validation selects the default for reversed and mixed separators; fixed validation retains the selected map and sets the expected host metadata.
  • Native separators, uppercase names, missing-map fallback, and custom-match preferences pass.
  • Separator helper passes sanitizer checks under both POSIX and Windows separator conventions.
  • Both games launch to the main menu, with -quickstart, and into a campaign mission.

@bobtista
bobtista marked this pull request as draft August 11, 2026 15:51
@bobtista bobtista self-assigned this Aug 11, 2026
@bobtista bobtista added the Platform Work towards platform support, such as Linux, MacOS label Aug 11, 2026
@bobtista
bobtista force-pushed the bobtista/bugfix/lan-map-resolution branch 2 times, most recently from 27877e2 to 5a83502 Compare August 28, 2026 07:18
@bobtista bobtista changed the title bugfix(gui): Resolve the host's selected map through the map cache bugfix(map): Resolve map names that carry either path separator Aug 28, 2026
@bobtista
bobtista force-pushed the bobtista/bugfix/lan-map-resolution branch 3 times, most recently from 4c4016b to 03ce108 Compare September 14, 2026 21:30
@bobtista bobtista changed the title bugfix(map): Resolve map names that carry either path separator bugfix(map): Accept either path separator in map lookups Sep 15, 2026
@bobtista
bobtista force-pushed the bobtista/bugfix/lan-map-resolution branch from 373f462 to fca1495 Compare September 30, 2026 22:06
@coderabbitai

coderabbitai Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Important

Review skipped

We couldn't safely recover the incremental review. No full review was started, and the last reviewed checkpoint was preserved. Retry later, or explicitly request a full review by commenting @coderabbitai full review.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

The change normalizes path separators in map-cache keys and lookups. LAN host initialization now resolves the preferred map through findMap and uses matched metadata to set the selected map and host slot details.

Changes

Map path matching

Layer / File(s) Summary
Path separator normalization
Core/GameEngine/Include/Common/FileSystem.h, Core/Libraries/Include/Lib/PathUtil.h, Core/GameEngine/Source/Common/System/FileSystem.cpp
Adds utilities that normalize path separators. The directory check compares the final path character with the native separator.
Map cache key normalization
Core/GameEngine/Source/Common/INI/INIMapCache.cpp, Core/GameEngine/Source/Common/UserPreferences.cpp, Core/GameEngine/Source/GameClient/MapUtil.cpp
Normalizes separators in map names, stored preferred map names, discovered paths, and cache lookups. Map validity and official-map checks use findMap. The fallback display name uses getFileName.
LAN host map resolution
Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp, GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp
Resolves the preferred map through findMap. When metadata is found, host initialization uses its filename and updates map availability, CRC, and file size.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: xezon

Merge Risk: Minimal · previous review 7d863

The change is intended to preserve preferred LAN maps across separator styles, and no concrete user-facing regression remains. No specific merge risk is identified.

Architecture risk: Low · up to 7d863

The change affects 3 systems.

Changed systems: Core, Generals, GeneralsMD

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — Core (service) was modified; 6 changed files map to changed impact.
  • observed — Generals (service) was modified; 1 changed file maps to changed impact.
  • observed — GeneralsMD (service) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in Core/GameEngine/Include/Common/FileSystem.h: FileSystem gains the public static normalizePathSeparators declaration, which takes an AsciiString path and returns an AsciiString; its comment specifies conversion from game-data separators to the native separator.
  • observed — Modified behavior in Core/GameEngine/Source/Common/System/FileSystem.cpp: isPathInDirectory replaces its platform-specific separator string and endsWith check with the native separator character and a final-character comparison before appending the separator.
  • observed — Modified behavior in Core/GameEngine/Source/Common/System/FileSystem.cpp: Adds FileSystem::normalizePathSeparators: it returns the original path when no non-native separator occurs; otherwise, it returns a copy with separators normalized to the native form.
  • observed — Modified behavior in Core/GameEngine/Source/Common/UserPreferences.cpp: Added the Common/FileSystem.h include.
Pre-merge checks: Passed 4

Check name Status Explanation
Linked Issues check Passed The PR satisfies issue [#3103]. MapCache::findMap normalizes both path separator styles before lookup. Map cache insertion and discovered filenames use native separators. Both Generals and GeneralsM…
Out of Scope Changes check Passed The changes stay within issue [#3103]. Separator normalization, cache-key normalization, validation updates, preference normalization, and the isPathInDirectory adjustment support consistent map-pat…
Title check Passed The title names the main change: map lookups now accept either path separator. It matches the objectives of the PR, which make validation and cache lookups use native separators, and it is a short, si…
Description check Passed The description states the problem: map validation rejects a preferred map that uses different path separators, so the default map is chosen. It then explains the fix (findMap validation, native-separ…
Full details: Linked Issues check

Explanation

The PR satisfies issue [#3103]. MapCache::findMap normalizes both path separator styles before lookup. Map cache insertion and discovered filenames use native separators. Both Generals and GeneralsMD LAN setup paths use findMap, apply the matched m_fileName, and update map availability, CRC, and size from matched metadata. The reported checks cover reversed and mixed separators, native separators, missing-map fallback, and custom-match preferences.

Full details: Out of Scope Changes check

Explanation

The changes stay within issue [#3103]. Separator normalization, cache-key normalization, validation updates, preference normalization, and the isPathInDirectory adjustment support consistent map-path matching. The Generals and GeneralsMD LAN changes directly address the host preferred-map lookup failure. No unrelated change is demonstrated.

Full details: Title check

Explanation

The title names the main change: map lookups now accept either path separator. It matches the objectives of the PR, which make validation and cache lookups use native separators, and it is a short, single sentence. The 'bugfix(map):' prefix is a conventional commit style, which is acceptable.

Full details: Description check

Explanation

The description states the problem: map validation rejects a preferred map that uses different path separators, so the default map is chosen. It then explains the fix (findMap validation, native-separator cache keys, LAN setup using the resolved filename, and normalization in custom-match preferences). It also gives reproduction steps and testing notes. It is related to the changeset.

ℹ️ Recent review info

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 89844945-de1e-471f-b8e0-2a20f48ba766

📥 Commits

Reviewing files that changed from the base of the PR and between fca14956dd58f9652040ca25775c552ccbf18087 and 7d863979158d411a1286877c78bbe0dff1afce53.

📒 Files selected for processing (1)

  • Core/GameEngine/Source/Common/INI/INIMapCache.cpp

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: f33cc683-9673-469a-826c-d206dd6ef89f

📥 Commits

Reviewing files that changed from the base of the PR and between b0c29eb and fca14956dd58f9652040ca25775c552ccbf18087.

📒 Files selected for processing (8)
  • Core/GameEngine/Include/Common/FileSystem.h
  • Core/GameEngine/Source/Common/INI/INIMapCache.cpp
  • Core/GameEngine/Source/Common/System/FileSystem.cpp
  • Core/GameEngine/Source/Common/UserPreferences.cpp
  • Core/GameEngine/Source/GameClient/MapUtil.cpp
  • Core/Libraries/Include/Lib/PathUtil.h
  • Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp
  • GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 1 remain after this review.

@bobtista
bobtista force-pushed the bobtista/bugfix/lan-map-resolution branch from 7d86397 to ad99ea0 Compare October 17, 2026 20:00
@bobtista
bobtista force-pushed the bobtista/bugfix/lan-map-resolution branch from ad99ea0 to e2a0415 Compare October 28, 2026 20:04
@bobtista
bobtista force-pushed the bobtista/bugfix/lan-map-resolution branch from e2a0415 to 840191c Compare November 5, 2026 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Platform Work towards platform support, such as Linux, MacOS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Host's preferred LAN map is not matched when its stored name uses a different separator

1 participant