Updated Launching of Lua Editor to supply the project-path (#7706)
* Updated Launching of Lua Editor to supply the project-path The Lua Launch logic also uses the AzFramework ProcessLauncher instead of Qt. This has the benefit of being able to pass arguments as an array instead of in a single string. Therefore paths with spaces in them also work. Tweak the Settings Registry logic to locate the project-path/engine-path by scanning upwards for a project.json/engine.json respectively to inject the found paths to the front of the command line parameters instead of the back. This has the effect of making sure that command line parameters for the project-path/engine-path always takes precedence over scanning upwards for a project.json/engine.json. Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Removed prepend of EngineRoot in CheckProjectPathProvided The Editor would attempt to validate that the project path supplied via the command line contained a valid project.json file before contining the Editor startup flow. This was taking the engine root path and appending the project path to it, which works when the project path is absolute But when the project path is relative it is treated as relative to the current working directory by the SettingsRegistry, but the logic in the CheckProjectPathProvided was treating it has relative to the engine root. Therefore supplying a relative path as part of the Editor.exe launch command would fail. Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Fixed resolving of relative paths to absolute paths in the Editor The Editor was changing the current working directory to the nearest ancestor directory containing an `engine.json` file. This resulted in the ConvertToAbsolutePath function resolving relative paths to that directory instead of the launch directory of the Editor. Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
606b4e9ec3
commit
669caca9cc
-4
@@ -208,10 +208,6 @@ namespace LegacyFramework
|
||||
*/
|
||||
virtual bool IsRunningInGUIMode() = 0;
|
||||
|
||||
/** Retrieve a Command Line Parser object that you can then use to check for values on the command line
|
||||
*/
|
||||
virtual const AzFramework::CommandLine* GetCommandLineParser() = 0;
|
||||
|
||||
/** (Windows) retrieves the main module of the executable.
|
||||
* This is always going to be the main executable except in the situation where the framework may be running as a DLL belonging to another process or program.
|
||||
*/
|
||||
|
||||
+5
-12
@@ -97,6 +97,10 @@ namespace LegacyFramework
|
||||
}
|
||||
|
||||
Application::Application()
|
||||
: Application(0, nullptr)
|
||||
{}
|
||||
Application::Application(int argc, char** argv)
|
||||
: ComponentApplication(argc, argv)
|
||||
{
|
||||
m_isPrimary = true;
|
||||
m_desiredExitCode = 0;
|
||||
@@ -191,9 +195,6 @@ namespace LegacyFramework
|
||||
::SetConsoleCtrlHandler(CTRL_BREAK_HandlerRoutine, true);
|
||||
#endif
|
||||
|
||||
m_ptrCommandLineParser = aznew AzFramework::CommandLine();
|
||||
m_ptrCommandLineParser->Parse(m_desc.m_argc, m_desc.m_argv);
|
||||
|
||||
// If we don't have one create a serialize context
|
||||
if (GetSerializeContext() == nullptr)
|
||||
{
|
||||
@@ -206,7 +207,7 @@ namespace LegacyFramework
|
||||
m_ptrSystemEntity->Activate();
|
||||
|
||||
// If we aren't the primary, RunAsAnotherInstance unless we are being forcestarted
|
||||
if (!m_isPrimary && !m_ptrCommandLineParser->HasSwitch("forcestart"))
|
||||
if (!m_isPrimary && !m_commandLine.HasSwitch("forcestart"))
|
||||
{
|
||||
// Required for the application component to handle RunAsAnotherInstance
|
||||
CreateApplicationComponent();
|
||||
@@ -246,9 +247,6 @@ namespace LegacyFramework
|
||||
::SetConsoleCtrlHandler(CTRL_BREAK_HandlerRoutine, false);
|
||||
#endif
|
||||
|
||||
delete m_ptrCommandLineParser;
|
||||
m_ptrCommandLineParser = nullptr;
|
||||
|
||||
CoreMessageBus::Handler::BusDisconnect();
|
||||
FrameworkApplicationMessages::Handler::BusDisconnect();
|
||||
|
||||
@@ -271,11 +269,6 @@ namespace LegacyFramework
|
||||
}
|
||||
}
|
||||
|
||||
const AzFramework::CommandLine* Application::GetCommandLineParser()
|
||||
{
|
||||
return m_ptrCommandLineParser;
|
||||
}
|
||||
|
||||
// returns TRUE if the component already existed, FALSE if it had to create one.
|
||||
bool Application::EnsureComponentCreated(AZ::Uuid componentCRC)
|
||||
{
|
||||
|
||||
+1
-2
@@ -56,6 +56,7 @@ namespace LegacyFramework
|
||||
using CoreMessageBus::Handler::Run;
|
||||
virtual int Run(const ApplicationDesc& desc);
|
||||
Application();
|
||||
Application(int argc, char** argv);
|
||||
|
||||
void CreateReflectionManager() override;
|
||||
|
||||
@@ -70,7 +71,6 @@ namespace LegacyFramework
|
||||
const char* GetApplicationName() override;
|
||||
const char* GetApplicationModule() override;
|
||||
const char* GetApplicationDirectory() override;
|
||||
const AzFramework::CommandLine* GetCommandLineParser() override;
|
||||
void TeardownApplicationComponent() override;
|
||||
void RunAssetProcessor() override;
|
||||
// ------------------------------------------------------------------
|
||||
@@ -138,7 +138,6 @@ namespace LegacyFramework
|
||||
volatile bool m_abortRequested; // if you CTRL+C in a console app, this becomes true. its up to you to check...
|
||||
char m_applicationFilePath[AZ_MAX_PATH_LEN];
|
||||
ApplicationDesc m_desc;
|
||||
AzFramework::CommandLine* m_ptrCommandLineParser;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
#include <AzCore/Serialization/SerializeContext.h>
|
||||
|
||||
#include <AzFramework/CommandLine/CommandLine.h>
|
||||
#include <AzCore/Settings/CommandLine.h>
|
||||
|
||||
#include <AzToolsFramework/UI/UICore/QWidgetSavedState.h>
|
||||
#include <AzToolsFramework/UI/LegacyFramework/Core/EditorFrameworkAPI.h>
|
||||
@@ -34,7 +34,6 @@ AZ_PUSH_DISABLE_WARNING(4251, "-Wunknown-warning-option") // '...' needs to have
|
||||
#include <QProxyStyle>
|
||||
AZ_POP_DISABLE_WARNING
|
||||
|
||||
#include <AzFramework/StringFunc/StringFunc.h>
|
||||
|
||||
#ifndef AZ_PLATFORM_WINDOWS
|
||||
int __argc = 0;
|
||||
@@ -201,8 +200,11 @@ namespace AzToolsFramework
|
||||
// enable the built-in stylesheet by default:
|
||||
bool enableStyleSheet = true;
|
||||
|
||||
const AzFramework::CommandLine* comp = nullptr;
|
||||
EBUS_EVENT_RESULT(comp, LegacyFramework::FrameworkApplicationMessages::Bus, GetCommandLineParser);
|
||||
const AZ::CommandLine* comp = nullptr;
|
||||
AZ::ComponentApplicationBus::Broadcast([&comp](AZ::ComponentApplicationRequests* requests)
|
||||
{
|
||||
comp = requests->GetAzCommandLine();
|
||||
});
|
||||
if (comp != nullptr)
|
||||
{
|
||||
if (comp->HasSwitch("nostyle"))
|
||||
|
||||
Reference in New Issue
Block a user