Fix issue moving and renaming projects at the same time (#1620)

main
AMZN-nggieber 5 years ago committed by GitHub
parent ccb784d7d5
commit a5e66505a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -215,22 +215,23 @@ namespace O3DE::ProjectManager
return false; 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 (!ProjectUtils::MoveProject(m_projectInfo.m_path, newProjectSettings.m_path))
if (!result.IsSuccess())
{ {
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; return false;
} }
} }
// Check if project path has changed and move it // Update project if settings changed
if (newProjectSettings.m_path != m_projectInfo.m_path)
{ {
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; return false;
} }
} }

Loading…
Cancel
Save