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
@@ -21,11 +21,11 @@
|
||||
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
|
||||
#include <AzCore/std/string/conversions.h>
|
||||
#include <AzCore/std/string/regex.h>
|
||||
#include <AzCore/StringFunc/StringFunc.h>
|
||||
|
||||
#include <AzFramework/Asset/AssetSystemBus.h>
|
||||
#include <AzFramework/Asset/AssetSystemComponent.h>
|
||||
#include <AzFramework/Asset/AssetCatalogBus.h>
|
||||
#include <AzFramework/StringFunc/StringFunc.h>
|
||||
#include <AzFramework/Asset/AssetProcessorMessages.h>
|
||||
|
||||
#include <AzToolsFramework/API/EditorAssetSystemAPI.h>
|
||||
@@ -244,7 +244,7 @@ namespace LUAEditor
|
||||
}
|
||||
|
||||
AZStd::vector<AZStd::string> files;
|
||||
AzFramework::StringFunc::Tokenize(parameters.c_str(), files, ";");
|
||||
AZ::StringFunc::Tokenize(parameters.c_str(), files, ";");
|
||||
if (!files.empty())
|
||||
{
|
||||
for (const auto& file : files)
|
||||
@@ -669,9 +669,12 @@ namespace LUAEditor
|
||||
return;
|
||||
}
|
||||
|
||||
const AzFramework::CommandLine* commandLine = nullptr;
|
||||
const AZ::CommandLine* commandLine = nullptr;
|
||||
|
||||
EBUS_EVENT_RESULT(commandLine, LegacyFramework::FrameworkApplicationMessages::Bus, GetCommandLineParser);
|
||||
AZ::ComponentApplicationBus::Broadcast([&commandLine](AZ::ComponentApplicationRequests* requests)
|
||||
{
|
||||
commandLine = requests->GetAzCommandLine();
|
||||
});
|
||||
|
||||
bool forceShow = false;
|
||||
bool forceHide = false;
|
||||
@@ -850,7 +853,7 @@ namespace LUAEditor
|
||||
DocumentInfo& info = infoEntry.first->second;
|
||||
info.m_assetId = normalizedAssetId;
|
||||
info.m_assetName = assetId;
|
||||
AzFramework::StringFunc::Path::GetFullFileName(assetId.c_str(), info.m_displayName);
|
||||
AZ::StringFunc::Path::GetFullFileName(assetId.c_str(), info.m_displayName);
|
||||
info.m_bSourceControl_Ready = true;
|
||||
info.m_bSourceControl_CanWrite = true;
|
||||
info.m_bUntitledDocument = false;
|
||||
@@ -945,7 +948,7 @@ namespace LUAEditor
|
||||
// do not allow SaveAs onto an existing asset, even if it could be checked out and modified "safely."
|
||||
// end user must check out and modify contents directly if they want this
|
||||
|
||||
if (AzFramework::StringFunc::Find(newAssetName.c_str(), ".lua") == AZStd::string::npos)
|
||||
if (AZ::StringFunc::Find(newAssetName.c_str(), ".lua") == AZStd::string::npos)
|
||||
{
|
||||
newAssetName += ".lua";
|
||||
}
|
||||
@@ -961,7 +964,7 @@ namespace LUAEditor
|
||||
|
||||
trySaveAs = false;
|
||||
docInfoIter->second.m_bUntitledDocument = false;
|
||||
AzFramework::StringFunc::Path::GetFullFileName(newAssetName.c_str(), docInfoIter->second.m_displayName);
|
||||
AZ::StringFunc::Path::GetFullFileName(newAssetName.c_str(), docInfoIter->second.m_displayName);
|
||||
|
||||
// when you 'save as' you can write to it, even if it started out not that way.
|
||||
docInfoIter->second.m_bSourceControl_Ready = true;
|
||||
@@ -1489,7 +1492,7 @@ namespace LUAEditor
|
||||
|
||||
DocumentInfo info;
|
||||
info.m_assetName = assetIdLower;
|
||||
AzFramework::StringFunc::Path::GetFullFileName(assetId.c_str(), info.m_displayName);
|
||||
AZ::StringFunc::Path::GetFullFileName(assetId.c_str(), info.m_displayName);
|
||||
info.m_assetId = assetIdLower;
|
||||
info.m_bSourceControl_BusyGettingStats = true;
|
||||
info.m_bSourceControl_BusyGettingStats = false;
|
||||
@@ -1555,7 +1558,10 @@ namespace LUAEditor
|
||||
const AZStd::string k_luaScriptFileString = "files";
|
||||
|
||||
const AzFramework::CommandLine* commandLine = nullptr;
|
||||
EBUS_EVENT_RESULT(commandLine, LegacyFramework::FrameworkApplicationMessages::Bus, GetCommandLineParser);
|
||||
AZ::ComponentApplicationBus::Broadcast([&commandLine](AZ::ComponentApplicationRequests* requests)
|
||||
{
|
||||
commandLine = requests->GetAzCommandLine();
|
||||
});
|
||||
|
||||
AZStd::string parameters = "";
|
||||
size_t numSwitchValues = commandLine->GetNumSwitchValues(k_luaScriptFileString);
|
||||
@@ -2448,7 +2454,7 @@ namespace LUAEditor
|
||||
if (matchFound)
|
||||
{
|
||||
int lineNumber = 0;
|
||||
if (AzFramework::StringFunc::LooksLikeInt(match[1].str().c_str(), &lineNumber))
|
||||
if (AZ::StringFunc::LooksLikeInt(match[1].str().c_str(), &lineNumber))
|
||||
{
|
||||
errorData->m_lineNumber = lineNumber;
|
||||
finalMessage = match[2].str().c_str();
|
||||
@@ -2467,6 +2473,6 @@ namespace LUAEditor
|
||||
|
||||
bool Context::IsLuaAsset(const AZStd::string& assetPath)
|
||||
{
|
||||
return AzFramework::StringFunc::Path::IsExtension(assetPath.c_str(), ".lua");
|
||||
return AZ::StringFunc::Path::IsExtension(assetPath.c_str(), ".lua");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,8 @@
|
||||
namespace LUAEditor
|
||||
{
|
||||
|
||||
Application::Application(int &argc, char **argv) : BaseApplication(argc, argv)
|
||||
Application::Application(int argc, char **argv)
|
||||
: BaseApplication(argc, argv)
|
||||
{
|
||||
AzToolsFramework::SourceControlNotificationBus::Handler::BusConnect();
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace LUAEditor
|
||||
, protected AzToolsFramework::SourceControlNotificationBus::Handler
|
||||
{
|
||||
public:
|
||||
Application(int &argc, char **argv);
|
||||
Application(int argc, char **argv);
|
||||
~Application() override;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
|
||||
namespace StandaloneTools
|
||||
{
|
||||
BaseApplication::BaseApplication(int&, char**)
|
||||
: LegacyFramework::Application()
|
||||
BaseApplication::BaseApplication(int argc, char** argv)
|
||||
: LegacyFramework::Application(argc, argv)
|
||||
{
|
||||
AZ::UserSettingsFileLocatorBus::Handler::BusConnect();
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace StandaloneTools
|
||||
{
|
||||
public:
|
||||
|
||||
BaseApplication(int &argc, char **argv);
|
||||
BaseApplication(int argc, char **argv);
|
||||
~BaseApplication() override;
|
||||
|
||||
protected:
|
||||
|
||||
Reference in New Issue
Block a user