[LYN-8041] Enable relocation of the Project Game Release Layout (#5380)
* Enable relocation of the Project Game Release Layout Relocating the Project Game Release Layout to another directory on the file system failed due to the querying of the engine root failing due to the ComponentApplication::m_engineRoot not using the project path stored in the SettingsRegisry if the engine root cannot be detected Removed the ApplicationRequestBus GetEngineRoot function. The ComponentApplicationRequestBus has a function of the same name that returns the same path. Removed the deprecated GetAppRoot function. The path it returns has no defined value. It was not the engine root or the project root. Removed unused CFileUtil and CFileUtil_impl functions that were invoking the ApplicationREquestBus GetEngineRoot function. On the way to update the functions it was discovered that they aren't called Added a CalculateBranchToken overload that can populate a fixed_string to avoid heap allocations Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Protect against an empty list of artifacts to remove when generating the engine.pak Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
d053a03b5f
commit
5fc4551ac0
@@ -67,12 +67,6 @@ namespace AzFramework
|
||||
/// Make path relative to the provided root.
|
||||
virtual void MakePathRelative(AZStd::string& /*fullPath*/, const char* /*rootPath*/) {}
|
||||
|
||||
/// Gets the engine root path where the modules for the current engine are located.
|
||||
virtual const char* GetEngineRoot() const { return nullptr; }
|
||||
|
||||
/// Retrieves the app root path for the application.
|
||||
virtual const char* GetAppRoot() const { return nullptr; }
|
||||
|
||||
/// Get the Command Line arguments passed in.
|
||||
virtual const CommandLine* GetCommandLine() { return nullptr; }
|
||||
|
||||
|
||||
@@ -225,13 +225,6 @@ namespace AzFramework
|
||||
}
|
||||
}
|
||||
|
||||
void Application::PreModuleLoad()
|
||||
{
|
||||
SetRootPath(RootPathType::EngineRoot, m_engineRoot.c_str());
|
||||
AZ_TracePrintf(s_azFrameworkWarningWindow, "Engine Path: %s\n", m_engineRoot.c_str());
|
||||
}
|
||||
|
||||
|
||||
void Application::Stop()
|
||||
{
|
||||
if (m_isStarted)
|
||||
@@ -397,11 +390,6 @@ namespace AzFramework
|
||||
outModules.emplace_back(aznew AzFrameworkModule());
|
||||
}
|
||||
|
||||
const char* Application::GetAppRoot() const
|
||||
{
|
||||
return m_appRoot.c_str();
|
||||
}
|
||||
|
||||
const char* Application::GetCurrentConfigurationName() const
|
||||
{
|
||||
#if defined(_RELEASE)
|
||||
@@ -437,19 +425,19 @@ namespace AzFramework
|
||||
|
||||
void Application::ResolveEnginePath(AZStd::string& engineRelativePath) const
|
||||
{
|
||||
AZ::IO::FixedMaxPath fullPath = m_engineRoot / engineRelativePath;
|
||||
auto fullPath = AZ::IO::FixedMaxPath(GetEngineRoot()) / engineRelativePath;
|
||||
engineRelativePath = fullPath.String();
|
||||
}
|
||||
|
||||
void Application::CalculateBranchTokenForEngineRoot(AZStd::string& token) const
|
||||
{
|
||||
AzFramework::StringFunc::AssetPath::CalculateBranchToken(m_engineRoot.String(), token);
|
||||
AZ::StringFunc::AssetPath::CalculateBranchToken(GetEngineRoot(), token);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
void Application::MakePathRootRelative(AZStd::string& fullPath)
|
||||
{
|
||||
MakePathRelative(fullPath, m_engineRoot.c_str());
|
||||
MakePathRelative(fullPath, GetEngineRoot());
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
@@ -585,30 +573,6 @@ namespace AzFramework
|
||||
}
|
||||
}
|
||||
|
||||
void Application::SetRootPath(RootPathType type, const char* source)
|
||||
{
|
||||
[[maybe_unused]] const size_t sourceLen = strlen(source);
|
||||
|
||||
// Copy the source path to the intended root path and correct the path separators as well
|
||||
switch (type)
|
||||
{
|
||||
case RootPathType::AppRoot:
|
||||
{
|
||||
AZ_Assert(sourceLen < m_appRoot.Native().max_size(), "String overflow for App Root: %s", source);
|
||||
m_appRoot = AZ::IO::PathView(source).LexicallyNormal();
|
||||
}
|
||||
break;
|
||||
case RootPathType::EngineRoot:
|
||||
{
|
||||
AZ_Assert(sourceLen < m_engineRoot.Native().max_size(), "String overflow for Engine Root: %s", source);
|
||||
m_engineRoot = AZ::IO::PathView(source).LexicallyNormal();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
AZ_Assert(false, "Invalid RootPathType (%d)", static_cast<int>(type));
|
||||
}
|
||||
}
|
||||
|
||||
struct DeprecatedAliasesKeyVisitor
|
||||
: AZ::SettingsRegistryInterface::Visitor
|
||||
{
|
||||
|
||||
@@ -95,8 +95,6 @@ namespace AzFramework
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! ApplicationRequests::Bus::Handler
|
||||
const char* GetEngineRoot() const override { return m_engineRoot.c_str(); }
|
||||
const char* GetAppRoot() const override;
|
||||
void ResolveEnginePath(AZStd::string& engineRelativePath) const override;
|
||||
void CalculateBranchTokenForEngineRoot(AZStd::string& token) const override;
|
||||
bool IsPrefabSystemEnabled() const override;
|
||||
@@ -146,8 +144,6 @@ namespace AzFramework
|
||||
*/
|
||||
void SetFileIOAliases();
|
||||
|
||||
void PreModuleLoad() override;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! AZ::ComponentApplication
|
||||
void RegisterCoreComponents() override;
|
||||
@@ -181,13 +177,7 @@ namespace AzFramework
|
||||
bool m_ownsConsole = false;
|
||||
|
||||
bool m_exitMainLoopRequested = false;
|
||||
|
||||
enum class RootPathType
|
||||
{
|
||||
AppRoot,
|
||||
EngineRoot
|
||||
};
|
||||
void SetRootPath(RootPathType type, const char* source);
|
||||
|
||||
};
|
||||
} // namespace AzFramework
|
||||
|
||||
|
||||
Reference in New Issue
Block a user