O3DE.exe Project-Centric "Open Editor" fix (#5852)
* The O3DE.exe Open Editor button now attempts to open the Editor in the build directory of the project being opened. If their is no Editor within the build directory of the Project, it uses the Editor.exe in the current O3DE.exe executable directory if it exists Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Engine .gitignore now ignores the build directory if placed in the AutomatedTesting project Previously it was just ignoring a `[Bb]uild` directory if it was directly within the engine root. This change matches the behavior of the project templates. Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Renamed the ProjectUtils GetEditorDirectory function to GetEditorExecutablePath Added a platform specific implementation for retrieving the path to the Editor executable in the GetEditorExectuablePath function. It first attempts to locate the Editor via checking the project build directory for an Editor executable before falling back to checking the binary directory of the currently running O3DE executable. Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Correct the MacOS GetEditorExecutablePath to return the Editor path Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
4ac8b5dc42
commit
99d0c39273
@@ -215,9 +215,7 @@ namespace O3DE::ProjectManager
|
||||
#if AZ_TRAIT_PROJECT_MANAGER_CREATE_DESKTOP_SHORTCUT
|
||||
menu->addAction(tr("Create Editor desktop shortcut..."), this, [this]()
|
||||
{
|
||||
AZ::IO::FixedMaxPath executableDirectory = ProjectUtils::GetEditorDirectory();
|
||||
AZStd::string executableFilename = "Editor";
|
||||
AZ::IO::FixedMaxPath editorExecutablePath = executableDirectory / (executableFilename + AZ_TRAIT_OS_EXECUTABLE_EXTENSION);
|
||||
AZ::IO::FixedMaxPath editorExecutablePath = ProjectUtils::GetEditorExecutablePath(m_projectInfo.m_path.toUtf8().constData());
|
||||
|
||||
const QString shortcutName = QString("%1 Editor").arg(m_projectInfo.m_displayName);
|
||||
const QString arg = QString("--regset=\"/Amazon/AzCore/Bootstrap/project_path=%1\"").arg(m_projectInfo.m_path);
|
||||
|
||||
@@ -76,7 +76,27 @@ namespace O3DE::ProjectManager
|
||||
*/
|
||||
AZ::Outcome<QString, QString> CreateDesktopShortcut(const QString& filename, const QString& targetPath, const QStringList& arguments);
|
||||
|
||||
AZ::IO::FixedMaxPath GetEditorDirectory();
|
||||
/**
|
||||
* Lookup the location of an Editor executable executable that can be used with the
|
||||
* supplied project path
|
||||
* First the method attempts to locate a build directory with the project path
|
||||
* via querying the <project-path>/user/Registry/Platform/<platform>/build_path.setreg
|
||||
* Once that is done a path is formed to locate the Editor executable within the that build
|
||||
* directory.
|
||||
* Two paths will checked for the existence of an Editor
|
||||
* - "<project-build-directory>/bin/$<CONFIG>/Editor"
|
||||
* - "<project-build-directory>/bin/<platform>/$<CONFIG>/Editor"
|
||||
* Where <platform> is the current platform the O3DE executable is running on and $<CONFIG> is the
|
||||
* current build configuration the O3DE executable
|
||||
*
|
||||
* If neiether of the above paths contain an Editor application, then a path to the Editor
|
||||
* is formed by combinding the O3DE executable directory with the filename of Editor
|
||||
* - "<executable-directory>/Editor"
|
||||
*
|
||||
* @param projectPath Path to the root of the project
|
||||
* @return path of the Editor Executable if found or an empty path if not
|
||||
*/
|
||||
AZ::IO::FixedMaxPath GetEditorExecutablePath(const AZ::IO::PathView& projectPath);
|
||||
|
||||
} // namespace ProjectUtils
|
||||
} // namespace O3DE::ProjectManager
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include <AzFramework/Process/ProcessCommon.h>
|
||||
#include <AzFramework/Process/ProcessWatcher.h>
|
||||
#include <AzCore/Utils/Utils.h>
|
||||
#include <AzCore/Settings/SettingsRegistry.h>
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
@@ -408,18 +407,26 @@ namespace O3DE::ProjectManager
|
||||
emit ChangeScreenRequest(ProjectManagerScreen::Projects);
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectsScreen::HandleOpenProject(const QString& projectPath)
|
||||
{
|
||||
if (!projectPath.isEmpty())
|
||||
{
|
||||
if (!WarnIfInBuildQueue(projectPath))
|
||||
{
|
||||
AZ::IO::FixedMaxPath executableDirectory = ProjectUtils::GetEditorDirectory();
|
||||
AZStd::string executableFilename = "Editor";
|
||||
AZ::IO::FixedMaxPath editorExecutablePath = executableDirectory / (executableFilename + AZ_TRAIT_OS_EXECUTABLE_EXTENSION);
|
||||
AZ::IO::FixedMaxPath fixedProjectPath = projectPath.toUtf8().constData();
|
||||
AZ::IO::FixedMaxPath editorExecutablePath = ProjectUtils::GetEditorExecutablePath(fixedProjectPath);
|
||||
if (editorExecutablePath.empty())
|
||||
{
|
||||
AZ_Error("ProjectManager", false, "Failed to locate editor");
|
||||
QMessageBox::critical(
|
||||
this, tr("Error"), tr("Failed to locate the Editor, please verify that it is built."));
|
||||
return;
|
||||
}
|
||||
|
||||
auto cmdPath = AZ::IO::FixedMaxPathString::format(
|
||||
"%s --regset=\"/Amazon/AzCore/Bootstrap/project_path=%s\"", editorExecutablePath.c_str(),
|
||||
projectPath.toStdString().c_str());
|
||||
fixedProjectPath.c_str());
|
||||
|
||||
AzFramework::ProcessLauncher::ProcessLaunchInfo processLaunchInfo;
|
||||
processLaunchInfo.m_commandlineParameters = cmdPath;
|
||||
|
||||
Reference in New Issue
Block a user