From a36b0327d35f536a3a79598df8b60d9f3eb6e14c Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Tue, 28 Jul 2026 22:42:00 +0200 Subject: [PATCH] Fix build regressions --- Content/Editor/Gizmo/MaterialWire.flax | 4 +- Source/Engine/Platform/Mac/MacWindow.cpp | 2 +- Source/Engine/Platform/Mac/MacWindow.h | 2 +- Source/Engine/Platform/SDL/SDLPlatform.cpp | 62 +++++++++++++++++++++- 4 files changed, 65 insertions(+), 5 deletions(-) diff --git a/Content/Editor/Gizmo/MaterialWire.flax b/Content/Editor/Gizmo/MaterialWire.flax index e7d871456..daf4fc1f6 100644 --- a/Content/Editor/Gizmo/MaterialWire.flax +++ b/Content/Editor/Gizmo/MaterialWire.flax @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fee4c6320e5cd0213509c512808a7cf460def968edebd03fd6c31b7cd4c45afb -size 32511 +oid sha256:53c54d6b1058ac631dbd9f1611553c8b43c2964a4e32074b96e7c0fd4dfc55f5 +size 32862 diff --git a/Source/Engine/Platform/Mac/MacWindow.cpp b/Source/Engine/Platform/Mac/MacWindow.cpp index 512d4b7a0..5a133f64e 100644 --- a/Source/Engine/Platform/Mac/MacWindow.cpp +++ b/Source/Engine/Platform/Mac/MacWindow.cpp @@ -1306,7 +1306,7 @@ void MacWindow::SetCursor(CursorType type) } } -void MacWindow::SetIcon(TextureData& icon) +void MacWindow::SetIcon(const TextureData& icon) { // Get pixels Array colorData; diff --git a/Source/Engine/Platform/Mac/MacWindow.h b/Source/Engine/Platform/Mac/MacWindow.h index 76a2690a8..363285c34 100644 --- a/Source/Engine/Platform/Mac/MacWindow.h +++ b/Source/Engine/Platform/Mac/MacWindow.h @@ -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 diff --git a/Source/Engine/Platform/SDL/SDLPlatform.cpp b/Source/Engine/Platform/SDL/SDLPlatform.cpp index 30851193a..9cafdfe13 100644 --- a/Source/Engine/Platform/SDL/SDLPlatform.cpp +++ b/Source/Engine/Platform/SDL/SDLPlatform.cpp @@ -407,6 +407,66 @@ bool ReadStream(SDL_IOStream*& stream, char* buffer, int64 bufferLength, int64& return success; } +bool ParseArguments(const StringView& cmdLine, Array& 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 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;