feat(system): Add -cwd option to keep or override the startup working directory - #3149
feat(system): Add -cwd option to keep or override the startup working directory#3149CryoTheRenegade wants to merge 3 commits into
Conversation
… directory Co-authored-by: Cursor <cursoragent@cursor.com>
PR Summary by QodoAdd -cwd flag to control startup working directory across game and tools
AI Description
Diagram
High-Level Assessment
Files changed (9)
|
Code Review by Qodo
1.
|
Co-authored-by: Cursor <cursoragent@cursor.com>
| } | ||
| } | ||
|
|
||
| static Bool setCurrentDirectoryToExecutablePath() |
There was a problem hiding this comment.
To me this looks like beyond the responsibility of a command line class. This code should probably be somewhere else.
| // TheSuperHackers @feature 14/08/2026 | ||
| // Working directory is applied earlier by CommandLine::applyStartupWorkingDirectory(). | ||
| // Consume an optional path argument here so it is not treated as another flag. | ||
| if (num > 1 && args[1] != nullptr && args[1][0] != '-') |
There was a problem hiding this comment.
This does not look well designed. It should do the real thing in here.
There was a problem hiding this comment.
You can probabaly move this higher before the working directory is set?
…Line Co-authored-by: Cursor <cursoragent@cursor.com>
Summary
-cwdso the game and tools can run with an executable outside the install directoryCommandLine::applyStartupWorkingDirectory()helperThis recreates the abandoned #1445 feature and applies the review feedback from that PR:
-cwdbehavior-cwd <path>is a small step toward a customizable read-only data location without rewriting every relative file loadExample Visual Studio usage: add
-cwdto Command Arguments and set Working Directory to the game install path.Considerations from #1445:
mss32.dllandBINKW32.DLLare not system DLLs, so this is fine. See Win32 DLL search orderLoadImageA,LoadCursorFromFile, ...) search the executable path, then the current working directory, then%PATH%. See OpenFile remarksfopenalways use the current working directoryThis change was drafted with LLM assistance