Handle case where engine.json missing or corrupt (#7049)

Signed-off-by: Alex Peterson <26804013+AMZN-alexpete@users.noreply.github.com>
This commit is contained in:
Alex Peterson
2022-01-21 13:09:09 -08:00
committed by GitHub
parent 93358dcbeb
commit 1909e5fa54
3 changed files with 8 additions and 6 deletions
@@ -196,9 +196,7 @@ namespace O3DE::ProjectManager
return true;
}
bool forceRegistration = false;
// check if an engine with this name is already registered
// check if an engine with this name is already registered and has a valid engine.json
auto existingEngineResult = m_pythonBindings->GetEngineInfo(engineInfo.m_name);
if (existingEngineResult)
{
@@ -230,10 +228,11 @@ namespace O3DE::ProjectManager
// user elected not to change the name or force registration
return false;
}
forceRegistration = true;
}
// always force register in case there is an engine registered in o3de_manifest.json, but
// the engine.json is missing or corrupt in which case GetEngineInfo() fails
constexpr bool forceRegistration = true;
auto registerOutcome = m_pythonBindings->SetEngineInfo(engineInfo, forceRegistration);
if (!registerOutcome)
{
@@ -459,6 +459,9 @@ namespace O3DE::ProjectManager
if (!pybind11::isinstance<pybind11::none>(enginePathResult))
{
engineInfo = EngineInfoFromPath(enginePathResult);
// it is possible an engine is registered in o3de_manifest.json but the engine.json is
// missing or corrupt in which case we do not consider it a registered engine
}
});
+1 -1
View File
@@ -608,7 +608,7 @@ def get_registered(engine_name: str = None,
except json.JSONDecodeError as e:
logger.warning(f'{engine_json} failed to load: {str(e)}')
else:
this_engines_name = engine_json_data['engine_name']
this_engines_name = engine_json_data.get('engine_name','')
if this_engines_name == engine_name:
return engine_path
engines_path = json_data.get('engines_path', {})