[*] Emulate \\ escaping on NT CmdLine parsing
This commit is contained in:
parent
191f5df2a1
commit
9c18cb06e0
@ -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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user