From a5e66505a0131789e9b30091ba7f4bce6a6ad1e6 Mon Sep 17 00:00:00 2001 From: AMZN-nggieber <52797929+AMZN-nggieber@users.noreply.github.com> Date: Mon, 28 Jun 2021 19:58:00 -0700 Subject: [PATCH] Fix issue moving and renaming projects at the same time (#1620) --- .../ProjectManager/Source/UpdateProjectCtrl.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Code/Tools/ProjectManager/Source/UpdateProjectCtrl.cpp b/Code/Tools/ProjectManager/Source/UpdateProjectCtrl.cpp index d130ab50ce..3f72b7058e 100644 --- a/Code/Tools/ProjectManager/Source/UpdateProjectCtrl.cpp +++ b/Code/Tools/ProjectManager/Source/UpdateProjectCtrl.cpp @@ -215,22 +215,23 @@ namespace O3DE::ProjectManager return false; } - // Update project if settings changed + // Check if project path has changed and move it + // Move project first to avoid trying to update settings at the new location before it has been moved there + if (newProjectSettings.m_path != m_projectInfo.m_path) { - auto result = PythonBindingsInterface::Get()->UpdateProject(newProjectSettings); - if (!result.IsSuccess()) + if (!ProjectUtils::MoveProject(m_projectInfo.m_path, newProjectSettings.m_path)) { - QMessageBox::critical(this, tr("Project update failed"), tr(result.GetError().c_str())); + QMessageBox::critical(this, tr("Project move failed"), tr("Failed to move project.")); return false; } } - // Check if project path has changed and move it - if (newProjectSettings.m_path != m_projectInfo.m_path) + // Update project if settings changed { - if (!ProjectUtils::MoveProject(m_projectInfo.m_path, newProjectSettings.m_path)) + auto result = PythonBindingsInterface::Get()->UpdateProject(newProjectSettings); + if (!result.IsSuccess()) { - QMessageBox::critical(this, tr("Project move failed"), tr("Failed to move project.")); + QMessageBox::critical(this, tr("Project update failed"), tr(result.GetError().c_str())); return false; } }