aboutsummaryrefslogtreecommitdiff
path: root/src/zenutil/commandlineoptions.cpp
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2026-01-22 12:56:08 +0100
committerGitHub Enterprise <[email protected]>2026-01-22 12:56:08 +0100
commita735026f7376456eba7fb55e0c70c3353ea9c25a (patch)
tree56524229d934c4e08236598ad9abb0ba6c13bc8d /src/zenutil/commandlineoptions.cpp
parentfixed bad merge in CHANGELOG.md (diff)
downloadzen-a735026f7376456eba7fb55e0c70c3353ea9c25a.tar.xz
zen-a735026f7376456eba7fb55e0c70c3353ea9c25a.zip
hotfix 5.7.18 (#730)
* make sure we properly convert command line args for zenserver as well * make sure we *add* wildcards/excludes in addition to defaults
Diffstat (limited to 'src/zenutil/commandlineoptions.cpp')
-rw-r--r--src/zenutil/commandlineoptions.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/zenutil/commandlineoptions.cpp b/src/zenutil/commandlineoptions.cpp
index 81699361b..d94564843 100644
--- a/src/zenutil/commandlineoptions.cpp
+++ b/src/zenutil/commandlineoptions.cpp
@@ -2,7 +2,11 @@
#include <zenutil/commandlineoptions.h>
+#include <zencore/string.h>
#include <filesystem>
+
+#include <zencore/windows.h>
+
#if ZEN_WITH_TESTS
# include <zencore/testing.h>
#endif // ZEN_WITH_TESTS
@@ -160,6 +164,29 @@ RemoveQuotes(const std::string_view& Arg)
return Arg;
}
+CommandLineConverter::CommandLineConverter(int& argc, char**& argv)
+{
+#if ZEN_PLATFORM_WINDOWS
+ LPWSTR RawCommandLine = GetCommandLineW();
+ std::string CommandLine = WideToUtf8(RawCommandLine);
+ Args = ParseCommandLine(CommandLine);
+#else
+ Args.reserve(argc);
+ for (int I = 0; I < argc; I++)
+ {
+ std::string Arg(argv[I]);
+ if ((!Arg.empty()) && (Arg != " "))
+ {
+ Args.emplace_back(std::move(Arg));
+ }
+ }
+#endif
+ RawArgs = StripCommandlineQuotes(Args);
+
+ argc = static_cast<int>(RawArgs.size());
+ argv = RawArgs.data();
+}
+
#if ZEN_WITH_TESTS
void