Fix build regressions
This commit is contained in:
Binary file not shown.
@@ -1306,7 +1306,7 @@ void MacWindow::SetCursor(CursorType type)
|
||||
}
|
||||
}
|
||||
|
||||
void MacWindow::SetIcon(TextureData& icon)
|
||||
void MacWindow::SetIcon(const TextureData& icon)
|
||||
{
|
||||
// Get pixels
|
||||
Array<Color32> colorData;
|
||||
|
||||
@@ -63,7 +63,7 @@ public:
|
||||
void StartTrackingMouse(bool useMouseScreenOffset) override;
|
||||
void EndTrackingMouse() override;
|
||||
void SetCursor(CursorType type) override;
|
||||
void SetIcon(TextureData& icon) override;
|
||||
void SetIcon(const TextureData& icon) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -407,6 +407,66 @@ bool ReadStream(SDL_IOStream*& stream, char* buffer, int64 bufferLength, int64&
|
||||
return success;
|
||||
}
|
||||
|
||||
bool ParseArguments(const StringView& cmdLine, Array<StringAnsi>& arguments)
|
||||
{
|
||||
int32 start = 0;
|
||||
int32 quotesStart = -1;
|
||||
int32 length = cmdLine.Length();
|
||||
for (int32 i = 0; i < length; i++)
|
||||
{
|
||||
if (cmdLine[i] == ' ' && quotesStart == -1)
|
||||
{
|
||||
int32 count = i - start;
|
||||
if (count > 0)
|
||||
arguments.Add(StringAnsi(cmdLine.Substring(start, count)));
|
||||
start = i + 1;
|
||||
}
|
||||
else if (cmdLine[i] == '\"')
|
||||
{
|
||||
if (quotesStart >= 0)
|
||||
{
|
||||
if (i + 1 < length && cmdLine[i + 1] != ' ')
|
||||
{
|
||||
// End quotes are in the middle of the current word,
|
||||
// continue until the end of the current word.
|
||||
}
|
||||
else
|
||||
{
|
||||
int32 offset = 1;
|
||||
if (quotesStart == start && cmdLine[start] == '\"')
|
||||
{
|
||||
// Word starts and ends with quotes, only include the quoted content.
|
||||
quotesStart++;
|
||||
offset--;
|
||||
}
|
||||
else if (quotesStart != start)
|
||||
{
|
||||
// Start quotes in the middle of the word, include the whole word.
|
||||
quotesStart = start;
|
||||
}
|
||||
|
||||
int32 count = i - quotesStart + offset;
|
||||
if (count > 0)
|
||||
arguments.Add(StringAnsi(cmdLine.Substring(quotesStart, count)));
|
||||
start = i + 1;
|
||||
}
|
||||
quotesStart = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
quotesStart = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
const int32 count = length - start;
|
||||
if (count > 0)
|
||||
arguments.Add(StringAnsi(cmdLine.Substring(start, count)));
|
||||
if (quotesStart >= 0)
|
||||
return true; // Missing last closing quote
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
int32 SDLPlatform::CreateProcess(CreateProcessSettings& settings)
|
||||
{
|
||||
LOG(Info, "Command: {0} {1}", settings.FileName, settings.Arguments);
|
||||
@@ -431,7 +491,7 @@ int32 SDLPlatform::CreateProcess(CreateProcessSettings& settings)
|
||||
// Parse argument list with possible quotes included
|
||||
Array<StringAnsi> arguments;
|
||||
arguments.Add(StringAnsi(settings.FileName));
|
||||
if (CommandLine::ParseArguments(settings.Arguments, arguments))
|
||||
if (ParseArguments(settings.Arguments, arguments))
|
||||
{
|
||||
LOG(Error, "Failed to parse arguments for process {}: '{}'", settings.FileName.Get(), settings.Arguments.Get());
|
||||
return -1;
|
||||
|
||||
Reference in New Issue
Block a user