Allow command line options to start with -
or --
Reviewed by: mimo Differential Revision: https://code.wildfiregames.com/D883 This was SVN commit r20249.
This commit is contained in:
parent
9d232fd39a
commit
7a5c5100c0
@ -457,7 +457,7 @@ static void RunGameOrAtlas(int argc, const char* argv[])
|
||||
|
||||
g_args = args;
|
||||
|
||||
if (args.Has("version") || args.Has("-version"))
|
||||
if (args.Has("version"))
|
||||
{
|
||||
debug_printf("Pyrogenesis %s\n", engine_version);
|
||||
return;
|
||||
|
@ -37,19 +37,19 @@ CmdLineArgs::CmdLineArgs(int argc, const char* argv[])
|
||||
if (argv[i][0] != '-')
|
||||
continue;
|
||||
|
||||
// Allow -arg and --arg
|
||||
char offset = argv[i][1] == '-' ? 2 : 1;
|
||||
CStr name, value;
|
||||
|
||||
// Check for "-arg=value"
|
||||
const char* eq = strchr(argv[i], '=');
|
||||
if (eq)
|
||||
{
|
||||
name = CStr(argv[i]+1, eq-argv[i]-1);
|
||||
name = CStr(argv[i]+offset, eq-argv[i]-offset);
|
||||
value = CStr(eq+1);
|
||||
}
|
||||
else
|
||||
{
|
||||
name = CStr(argv[i]+1);
|
||||
}
|
||||
name = CStr(argv[i]+offset);
|
||||
|
||||
m_Args.emplace_back(std::move(name), std::move(value));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user