aboutsummaryrefslogtreecommitdiff
path: root/zenserver/config.cpp
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2022-01-25 15:16:04 +0100
committerStefan Boberg <[email protected]>2022-01-25 15:16:04 +0100
commit080b73be664064d13eb88e53cd627ef859aa7da8 (patch)
tree1614a7637a33551e46dcb53ebb0e92d02a26b4f7 /zenserver/config.cpp
parentImplemented support for storing compressed buffers as values in structured ca... (diff)
parentCachepolicy (#36) (diff)
downloadzen-080b73be664064d13eb88e53cd627ef859aa7da8.tar.xz
zen-080b73be664064d13eb88e53cd627ef859aa7da8.zip
Merge branch 'main' of https://github.com/EpicGames/zen
Diffstat (limited to 'zenserver/config.cpp')
-rw-r--r--zenserver/config.cpp22
1 files changed, 18 insertions, 4 deletions
diff --git a/zenserver/config.cpp b/zenserver/config.cpp
index 4afe012dd..3c4f6f3d8 100644
--- a/zenserver/config.cpp
+++ b/zenserver/config.cpp
@@ -91,6 +91,16 @@ ParseCliOptions(int argc, char* argv[], ZenServerOptions& ServerOptions)
const char* DefaultHttp = "asio";
#endif
+ // Note to those adding future options; std::filesystem::path-type options
+ // must be read into a std::string first. As of cxxopts-3.0.0 it uses a >>
+ // stream operator to convert argv value into the options type. std::fs::path
+ // expects paths in streams to be quoted but argv paths are unquoted. By
+ // going into a std::string first, paths with whitespace parse correctly.
+ std::string DataDir;
+ std::string ContentDir;
+ std::string AbsLogFile;
+ std::string ConfigFile;
+
cxxopts::Options options("zenserver", "Zen Server");
options.add_options()("dedicated",
"Enable dedicated server mode",
@@ -99,10 +109,10 @@ ParseCliOptions(int argc, char* argv[], ZenServerOptions& ServerOptions)
options.add_options()("help", "Show command line help");
options.add_options()("t, test", "Enable test mode", cxxopts::value<bool>(ServerOptions.IsTest)->default_value("false"));
options.add_options()("log-id", "Specify id for adding context to log output", cxxopts::value<std::string>(ServerOptions.LogId));
- options.add_options()("data-dir", "Specify persistence root", cxxopts::value<std::filesystem::path>(ServerOptions.DataDir));
- options.add_options()("content-dir", "Frontend content directory", cxxopts::value<std::filesystem::path>(ServerOptions.ContentDir));
- options.add_options()("abslog", "Path to log file", cxxopts::value<std::filesystem::path>(ServerOptions.AbsLogFile));
- options.add_options()("config", "Path to Lua config file", cxxopts::value<std::filesystem::path>(ServerOptions.ConfigFile));
+ options.add_options()("data-dir", "Specify persistence root", cxxopts::value<std::string>(DataDir));
+ options.add_options()("content-dir", "Frontend content directory", cxxopts::value<std::string>(ContentDir));
+ options.add_options()("abslog", "Path to log file", cxxopts::value<std::string>(AbsLogFile));
+ options.add_options()("config", "Path to Lua config file", cxxopts::value<std::string>(ConfigFile));
options.add_options()("no-sentry",
"Disable Sentry crash handler",
cxxopts::value<bool>(ServerOptions.NoSentry)->default_value("false"));
@@ -327,6 +337,10 @@ ParseCliOptions(int argc, char* argv[], ZenServerOptions& ServerOptions)
exit(0);
}
+ ServerOptions.DataDir = DataDir;
+ ServerOptions.ContentDir = ContentDir;
+ ServerOptions.AbsLogFile = AbsLogFile;
+ ServerOptions.ConfigFile = ConfigFile;
ServerOptions.UpstreamCacheConfig.CachePolicy = ParseUpstreamCachePolicy(UpstreamCachePolicyOptions);
if (!ServerOptions.ConfigFile.empty())