[*] Emulate \\ escaping on NT CmdLine parsing

This commit is contained in:
Reece Wilson 2022-02-20 18:49:15 +00:00
parent 191f5df2a1
commit 9c18cb06e0

View File

@ -57,21 +57,42 @@ namespace Aurora::CmdLine
static void ProcessArgs() static void ProcessArgs()
{ {
AuString extendedLine;
AuString key;
for (const auto &arg : gCmdLineString) for (const auto &arg : gCmdLineString)
{ {
auto valueAssignment = arg.find('='); #if defined(AURORA_PLATFORM_WIN32)
if (valueAssignment == arg.npos) if (arg[arg.size() - 1] == '\\' && (arg.size() > 1))
{ {
gCmdFlags.push_back(arg); extendedLine += arg.substr(0, arg.size() - 1);
gCmdFlagLookup[arg] = true; if (arg[arg.size() - 2] != '\\')
{
extendedLine += ' ';
continue;
}
}
else
#endif
{
extendedLine += arg;
}
auto valueAssignment = extendedLine.find('=');
if (valueAssignment == extendedLine.npos)
{
gCmdFlags.push_back(extendedLine);
gCmdFlagLookup[extendedLine] = true;
} }
else else
{ {
auto key = arg.substr(0, valueAssignment); key = extendedLine.substr(0, valueAssignment);
auto val = arg.substr(valueAssignment + 1); extendedLine = extendedLine.substr(valueAssignment + 1);
gCmdValues.push_back(key); gCmdValues.push_back(key);
gCmdValueMap[key] = val; gCmdValueMap[key] = extendedLine;
} }
extendedLine.clear();
} }
} }