diff options
| author | Stefan Boberg <[email protected]> | 2025-11-03 15:50:19 +0100 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2025-11-03 15:50:19 +0100 |
| commit | 43f70003c9c3e38dddff49c873ce34fde2923abe (patch) | |
| tree | cff2471d5209225a553d85afff903fb68827b406 | |
| parent | Various fixes to address issues flagged by gcc / non-UE toolchain build (#621) (diff) | |
| download | zen-43f70003c9c3e38dddff49c873ce34fde2923abe.tar.xz zen-43f70003c9c3e38dddff49c873ce34fde2923abe.zip | |
added MacOS-native IterateCommandlineArgs (#624)
fixes issue where command line arguments to control tracing would not work on Mac
| -rw-r--r-- | CHANGELOG.md | 1 | ||||
| -rw-r--r-- | src/zencore/commandline.cpp | 16 |
2 files changed, 16 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index fcdbb7477..c4368e9a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## - Bugfix: Fixed race condition in Latch. Sometimes the Wait() could early out before the completion event had been set +- Bugfix: Fixed issue on MacOS where trace options would not stick due to `IterateCommandlineArgs` bug ## 5.7.7 - Feature: Added `zen builds prime-cache` command to download all blocks and build blobs for a build and upload to a zen cache host diff --git a/src/zencore/commandline.cpp b/src/zencore/commandline.cpp index 0cdccf986..78260aeef 100644 --- a/src/zencore/commandline.cpp +++ b/src/zencore/commandline.cpp @@ -10,6 +10,10 @@ ZEN_THIRD_PARTY_INCLUDES_START ZEN_THIRD_PARTY_INCLUDES_END #endif +#if ZEN_PLATFORM_MAC +# include <crt_externs.h> +#endif + #include <functional> namespace zen { @@ -35,7 +39,17 @@ IterateCommandlineArgs(std::function<void(const std::string_view& Arg)>& Process } ::LocalFree(HLOCAL(ArgV)); -#elif ZEN_PLATFORM_LINUX || ZEN_PLATFORM_MAC +#elif ZEN_PLATFORM_MAC + int ArgC = *_NSGetArgc(); + char** ArgV = *_NSGetArgv(); + if (ArgC > 1) + { + for (int i = 1; i < ArgC; ++i) + { + ProcessArg(ArgV[i]); + } + } +#elif ZEN_PLATFORM_LINUX if (FILE* CmdLineFile = fopen("/proc/self/cmdline", "r")) { const char* ArgV[255] = {}; |