From b31d673de0c71b5b5a6595e29ba7cd3ae0fd163d Mon Sep 17 00:00:00 2001 From: Steve Pham <82231385+spham-amzn@users.noreply.github.com> Date: Tue, 24 Aug 2021 13:43:02 -0700 Subject: [PATCH] Fix the Editor launcher for LuaIDE on Linux (#3407) Root Cause: On Linux, there is no need to wrap paths with double quotes for an executable when spawning a process with execve (or in this case QProcess::startDetached). Having the double quotes will result in an underlying "path not found" Signed-off-by: spham-amzn --- Code/Editor/CryEdit.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Code/Editor/CryEdit.cpp b/Code/Editor/CryEdit.cpp index 280613815e..f943265ec5 100644 --- a/Code/Editor/CryEdit.cpp +++ b/Code/Editor/CryEdit.cpp @@ -3910,11 +3910,19 @@ void CCryEditApp::OpenLUAEditor(const char* files) AZStd::string_view exePath; AZ::ComponentApplicationBus::BroadcastResult(exePath, &AZ::ComponentApplicationRequests::GetExecutableFolder); - AZStd::string process = AZStd::string::format("\"%.*s" AZ_CORRECT_FILESYSTEM_SEPARATOR_STRING "LuaIDE" +#if defined(AZ_PLATFORM_LINUX) + // On Linux platforms, launching a process is not done through a shell and its arguments are passed in + // separately. There is no need to wrap the process path in case of spaces in the path + constexpr const char* argumentQuoteString = ""; +#else + constexpr const char* argumentQuoteString = "\""; +#endif + + AZStd::string process = AZStd::string::format("%s%.*s" AZ_CORRECT_FILESYSTEM_SEPARATOR_STRING "LuaIDE" #if defined(AZ_PLATFORM_WINDOWS) ".exe" #endif - "\"", aznumeric_cast(exePath.size()), exePath.data()); + "%s", argumentQuoteString, aznumeric_cast(exePath.size()), exePath.data(), argumentQuoteString); AZStd::string processArgs = AZStd::string::format("%s -engine-path \"%s\"", args.c_str(), engineRoot); StartProcessDetached(process.c_str(), processArgs.c_str());