Skip to content

refactor(lib): Add path separator helpers to PathUtil - #3105

Draft
bobtista wants to merge 1 commit into
TheSuperHackers:mainfrom
bobtista:bobtista/refactor/path-separator-helpers
Draft

refactor(lib): Add path separator helpers to PathUtil#3105
bobtista wants to merge 1 commit into
TheSuperHackers:mainfrom
bobtista:bobtista/refactor/path-separator-helpers

Conversation

@bobtista

@bobtista bobtista commented Aug 11, 2026

Copy link
Copy Markdown

getExtension already had to find the last path separator and did it inline with maxPtr(strrchr(path, '/'), strrchr(path, '\\')). Several other call sites need the same thing, and some need the platform's own separator when building a path.

Now getNativePathSeparator(), isPathSeparator(), getLastPathSeparator() and getFileName() live in PathUtil.h, and getExtension uses them. getLastPathSeparator is maxPtr(strrchr(path, '/'), strrchr(path, '\\')), which is what the two getExtension overloads already did inline. No behavior change.

PathUtil.h is in Core/Libraries, which cannot depend on AsciiString in Core/GameEngine, so these are all const char* primitives. The AsciiString typed joining that #3107, #3108 and #3141 need is built on them at those call sites.

Todo:

  • Replicate to Generals: N/A, it's in Core

@bobtista
bobtista force-pushed the bobtista/refactor/path-separator-helpers branch from 0523a21 to d3fdd86 Compare August 27, 2026 16:30
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.

1 participant