Add an error message to AP when the project path is invalid (#4801)

* Add an error message to AP when bad project path

Produce a log error or a dialog box error when the project path for AP
does not have a project.json and is invalid.

Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com>

* Fix a failing unit test - AssetProcessorMessages

Adding a check for 'project.json' caused BeforeRun() in a test fixture
to fail.  Teardown of the fixture was also broken if the test failed to
fully startup the application manager, so added null checks there.

Added an assert to the fixture's Setup to check the status of BeforeRun().
Added additional settings registry setup to the fixture to make sure the
project path and branch token are configured before BeforeRun() is
called.

Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com>
This commit is contained in:
amzn-phist
2021-10-20 14:45:32 -05:00
committed by GitHub
parent fdce8a3085
commit 714f5357b2
3 changed files with 43 additions and 104 deletions
@@ -505,6 +505,14 @@ bool ApplicationManager::StartAZFramework()
AzFramework::Application::Descriptor appDescriptor;
AZ::ComponentApplication::StartupParameters params;
QDir projectPath{ AssetUtilities::ComputeProjectPath() };
if (!projectPath.exists("project.json"))
{
AZStd::string errorMsg = AZStd::string::format("Path '%s' is not a valid project path.", projectPath.path().toUtf8().constData());
AssetProcessor::MessageInfoBus::Broadcast(&AssetProcessor::MessageInfoBus::Events::OnErrorMessage, errorMsg.c_str());
return false;
}
QString projectName = AssetUtilities::ComputeProjectName();
// Prevent loading of gems in the Create method of the ComponentApplication
@@ -520,7 +528,6 @@ bool ApplicationManager::StartAZFramework()
//Registering all the Components
m_frameworkApp.RegisterComponentDescriptor(AzFramework::LogComponent::CreateDescriptor());
Reflect();
const AzFramework::CommandLine* commandLine = nullptr;