Files
o3de/Code/Sandbox/Editor/main.cpp
T
Eric Phister 7dd7e82d86 LYN-2723: Fixes issues with bad project or engine paths (#369)
* Setup NativeUIRequests as an AZ::Interface.  Adds a NativeUISystemComponent to AzFramework Application.

* Renames NativeUISystemComponent (class) to NativeUISystem, since it's no longer a Component.

* Minor update to SettingsRegistryInterface::Remove doc-comments for accuracy.

* Fixes to make an early fatal shutdown of Editor occur without crash.

* LYN-2723: Updates startup to handle errors: engine root is empty, no valid project.json found (mismatched engine name), or bad project path (launch project picker dialog).

* LYN-2723: Minor formatting/spelling edits.

* LYN-2723: Moves ParseCommandLine from ComponentApplication to SettingsRegistryMergeUtils so it can be used in more places.

* Misc fixes. 'wait_for_connect' setting wasn't being properly applied to AP connection settings. Fix infinite loop in CCmdLine::Next.

* LYN-2723: Addresses review feedback.

* LYN-2723: Reverts some changes that caused a unit test to fail.

* LYN-2723: Reverts one more change that was unnecessary.
2021-04-28 19:03:17 -05:00

44 lines
1.6 KiB
C++

/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <AzCore/Module/DynamicModuleHandle.h>
#include <AzFramework/ProjectManager/ProjectManager.h>
int main(int argc, char* argv[])
{
// Verify a project path can be found, launch the project manager and shut down otherwise
if (AzFramework::ProjectManager::CheckProjectPathProvided(argc, argv) == AzFramework::ProjectManager::ProjectPathCheckResult::ProjectManagerLaunched)
{
return 2;
}
using CryEditMain = int (*)(int, char*[]);
constexpr const char CryEditMainName[] = "CryEditMain";
AZ::Environment::Attach(AZ::Environment::GetInstance());
AZ::AllocatorInstance<AZ::OSAllocator>::Create();
auto handle = AZ::DynamicModuleHandle::Create("EditorLib");
[[maybe_unused]] const bool loaded = handle->Load(true);
AZ_Assert(loaded, "EditorLib could not be loaded");
int ret = 1;
if (auto fn = handle->GetFunction<CryEditMain>(CryEditMainName); fn != nullptr)
{
ret = AZStd::invoke(fn, argc, argv);
}
handle = {};
AZ::AllocatorInstance<AZ::OSAllocator>::Destroy();
AZ::Environment::Detach();
return ret;
}