[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
@@ -485,16 +485,6 @@ namespace AZ
|
||||
constexpr bool executeRegDumpCommands = false;
|
||||
SettingsRegistryMergeUtils::MergeSettingsToRegistry_CommandLine(*m_settingsRegistry, m_commandLine, executeRegDumpCommands);
|
||||
|
||||
// Query for the Executable Path using OS specific functions
|
||||
CalculateExecutablePath();
|
||||
|
||||
// Determine the path to the engine
|
||||
CalculateEngineRoot();
|
||||
|
||||
// If the current platform returns an engaged optional from Utils::GetDefaultAppRootPath(), that is used
|
||||
// for the application root.
|
||||
CalculateAppRoot();
|
||||
|
||||
SettingsRegistryMergeUtils::MergeSettingsToRegistry_O3deUserRegistry(*m_settingsRegistry, AZ_TRAIT_OS_PLATFORM_CODENAME, {});
|
||||
SettingsRegistryMergeUtils::MergeSettingsToRegistry_CommandLine(*m_settingsRegistry, m_commandLine, executeRegDumpCommands);
|
||||
SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddRuntimeFilePaths(*m_settingsRegistry);
|
||||
@@ -614,7 +604,8 @@ namespace AZ
|
||||
{
|
||||
AZ_Assert(!m_isStarted, "Component application already started!");
|
||||
|
||||
if (m_engineRoot.empty())
|
||||
using Type = AZ::SettingsRegistryInterface::Type;
|
||||
if (m_settingsRegistry->GetType(SettingsRegistryMergeUtils::FilePathKey_EngineRootFolder) == Type::NoType)
|
||||
{
|
||||
ReportBadEngineRoot();
|
||||
return nullptr;
|
||||
@@ -1180,6 +1171,24 @@ namespace AZ
|
||||
return ReflectionEnvironment::GetReflectionManager() ? ReflectionEnvironment::GetReflectionManager()->GetReflectContext<JsonRegistrationContext>() : nullptr;
|
||||
}
|
||||
|
||||
/// Returns the path to the engine.
|
||||
|
||||
const char* ComponentApplication::GetEngineRoot() const
|
||||
{
|
||||
static IO::FixedMaxPathString engineRoot;
|
||||
engineRoot.clear();
|
||||
m_settingsRegistry->Get(engineRoot, SettingsRegistryMergeUtils::FilePathKey_EngineRootFolder);
|
||||
return engineRoot.c_str();
|
||||
}
|
||||
|
||||
const char* ComponentApplication::GetExecutableFolder() const
|
||||
{
|
||||
static IO::FixedMaxPathString exeFolder;
|
||||
exeFolder.clear();
|
||||
m_settingsRegistry->Get(exeFolder, SettingsRegistryMergeUtils::FilePathKey_BinaryFolder);
|
||||
return exeFolder.c_str();
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
// CreateReflectionManager
|
||||
//=========================================================================
|
||||
@@ -1485,27 +1494,6 @@ namespace AZ
|
||||
}
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
// CalculateExecutablePath
|
||||
//=========================================================================
|
||||
void ComponentApplication::CalculateExecutablePath()
|
||||
{
|
||||
m_exeDirectory = Utils::GetExecutableDirectory();
|
||||
}
|
||||
|
||||
void ComponentApplication::CalculateAppRoot()
|
||||
{
|
||||
if (AZStd::optional<AZ::StringFunc::Path::FixedString> appRootPath = Utils::GetDefaultAppRootPath(); appRootPath)
|
||||
{
|
||||
m_appRoot = AZStd::move(*appRootPath);
|
||||
}
|
||||
}
|
||||
|
||||
void ComponentApplication::CalculateEngineRoot()
|
||||
{
|
||||
m_engineRoot = AZ::SettingsRegistryMergeUtils::FindEngineRoot(*m_settingsRegistry).Native();
|
||||
}
|
||||
|
||||
void ComponentApplication::ResolveModulePath([[maybe_unused]] AZ::OSString& modulePath)
|
||||
{
|
||||
// No special parsing of the Module Path is done by the Component Application anymore
|
||||
|
||||
@@ -221,13 +221,10 @@ namespace AZ
|
||||
BehaviorContext* GetBehaviorContext() override;
|
||||
/// Returns the json registration context that has been registered with the app, if there is one.
|
||||
JsonRegistrationContext* GetJsonRegistrationContext() override;
|
||||
/// Returns the working root folder that has been registered with the app, if there is one.
|
||||
/// It's expected that derived applications will implement an application root.
|
||||
const char* GetAppRoot() const override { return m_appRoot.c_str(); }
|
||||
/// Returns the path to the engine.
|
||||
const char* GetEngineRoot() const override { return m_engineRoot.c_str(); }
|
||||
const char* GetEngineRoot() const override;
|
||||
/// Returns the path to the folder the executable is in.
|
||||
const char* GetExecutableFolder() const override { return m_exeDirectory.c_str(); }
|
||||
const char* GetExecutableFolder() const override;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// TickRequestBus
|
||||
@@ -352,15 +349,6 @@ namespace AZ
|
||||
/// Adds system components requested by modules and the application to the system entity.
|
||||
void AddRequiredSystemComponents(AZ::Entity* systemEntity);
|
||||
|
||||
/// Calculates the directory the application executable comes from.
|
||||
void CalculateExecutablePath();
|
||||
|
||||
/// Calculates the root directory of the engine.
|
||||
void CalculateEngineRoot();
|
||||
|
||||
/// Deprecated: The term "AppRoot" has no meaning
|
||||
void CalculateAppRoot();
|
||||
|
||||
template<typename Iterator>
|
||||
static void NormalizePath(Iterator begin, Iterator end, bool doLowercase = true)
|
||||
{
|
||||
@@ -388,9 +376,6 @@ namespace AZ
|
||||
void* m_fixedMemoryBlock{ nullptr }; //!< Pointer to the memory block allocator, so we can free it OnDestroy.
|
||||
IAllocatorAllocate* m_osAllocator{ nullptr };
|
||||
EntitySetType m_entities;
|
||||
AZ::IO::FixedMaxPath m_exeDirectory;
|
||||
AZ::IO::FixedMaxPath m_engineRoot;
|
||||
AZ::IO::FixedMaxPath m_appRoot;
|
||||
|
||||
AZ::SettingsRegistryInterface::NotifyEventHandler m_projectPathChangedHandler;
|
||||
AZ::SettingsRegistryInterface::NotifyEventHandler m_projectNameChangedHandler;
|
||||
|
||||
@@ -175,10 +175,6 @@ namespace AZ
|
||||
//! the serializers used by the best-effort json serialization.
|
||||
virtual class JsonRegistrationContext* GetJsonRegistrationContext() = 0;
|
||||
|
||||
//! Gets the name of the working root folder that was registered with the app.
|
||||
//! @return a pointer to the name of the app's root folder, if a root folder was registered.
|
||||
virtual const char* GetAppRoot() const = 0;
|
||||
|
||||
//! Gets the path of the working engine folder that the app is a part of.
|
||||
//! @return a pointer to the engine path.
|
||||
virtual const char* GetEngineRoot() const = 0;
|
||||
|
||||
@@ -266,7 +266,8 @@ namespace AZ::SettingsRegistryMergeUtils
|
||||
|
||||
// Step 3 locate the project root and attempt to find the engine root using the registered engine
|
||||
// for the project in the project.json file
|
||||
AZ::IO::FixedMaxPath projectRoot = FindProjectRoot(settingsRegistry);
|
||||
AZ::IO::FixedMaxPath projectRoot;
|
||||
settingsRegistry.Get(projectRoot.Native(), FilePathKey_ProjectPath);
|
||||
if (projectRoot.empty())
|
||||
{
|
||||
return {};
|
||||
@@ -693,6 +694,7 @@ namespace AZ::SettingsRegistryMergeUtils
|
||||
R"(Project path isn't set in the Settings Registry at "%.*s".)"
|
||||
" Project-related filepaths will be set relative to the executable directory\n",
|
||||
AZ_STRING_ARG(projectPathKey));
|
||||
projectPath = exePath;
|
||||
registry.Set(FilePathKey_ProjectPath, exePath.Native());
|
||||
}
|
||||
|
||||
|
||||
@@ -1427,26 +1427,36 @@ namespace AZ
|
||||
|
||||
namespace AssetPath
|
||||
{
|
||||
void CalculateBranchToken(const AZStd::string& appRootPath, AZStd::string& token)
|
||||
namespace Internal
|
||||
{
|
||||
// Normalize the token to prepare for CRC32 calculation
|
||||
AZStd::string normalized = appRootPath;
|
||||
AZ::u32 CalculateBranchTokenHash(AZStd::string_view engineRootPath)
|
||||
{
|
||||
// Normalize the token to prepare for CRC32 calculation
|
||||
auto NormalizeEnginePath = [](const char element) -> char
|
||||
{
|
||||
// Substitute path separators with '_' and lower case
|
||||
return element == AZ::IO::WindowsPathSeparator || element == AZ::IO::PosixPathSeparator
|
||||
? '_' : static_cast<char>(std::tolower(element));
|
||||
};
|
||||
|
||||
// Strip out any trailing path separators
|
||||
AZ::StringFunc::Strip(normalized, AZ_CORRECT_FILESYSTEM_SEPARATOR_STRING AZ_WRONG_FILESYSTEM_SEPARATOR_STRING,false, false, true);
|
||||
// Trim off trailing path separators
|
||||
engineRootPath = RStrip(engineRootPath, AZ_CORRECT_AND_WRONG_FILESYSTEM_SEPARATOR);
|
||||
AZ::IO::FixedMaxPathString enginePath;
|
||||
AZStd::transform(engineRootPath.begin(), engineRootPath.end(),
|
||||
AZStd::back_inserter(enginePath), AZStd::move(NormalizeEnginePath));
|
||||
|
||||
// Lower case always
|
||||
AZStd::to_lower(normalized.begin(), normalized.end());
|
||||
|
||||
// Substitute path separators with '_'
|
||||
AZStd::replace(normalized.begin(), normalized.end(), '\\', '_');
|
||||
AZStd::replace(normalized.begin(), normalized.end(), '/', '_');
|
||||
|
||||
// Perform the CRC32 calculation
|
||||
const AZ::Crc32 branchTokenCrc(normalized.c_str(), normalized.size(), true);
|
||||
char branchToken[12];
|
||||
azsnprintf(branchToken, AZ_ARRAY_SIZE(branchToken), "0x%08X", static_cast<AZ::u32>(branchTokenCrc));
|
||||
token = AZStd::string(branchToken);
|
||||
// Perform the CRC32 calculation
|
||||
constexpr bool forceLowercase = true;
|
||||
return static_cast<AZ::u32>(AZ::Crc32(enginePath.c_str(), enginePath.size(), forceLowercase));
|
||||
}
|
||||
}
|
||||
void CalculateBranchToken(AZStd::string_view engineRootPath, AZStd::string& token)
|
||||
{
|
||||
token = AZStd::string::format("0x%08X", Internal::CalculateBranchTokenHash(engineRootPath));
|
||||
}
|
||||
void CalculateBranchToken(AZStd::string_view engineRootPath, AZ::IO::FixedMaxPathString& token)
|
||||
{
|
||||
token = AZ::IO::FixedMaxPathString::format("0x%08X", Internal::CalculateBranchTokenHash(engineRootPath));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -485,10 +485,11 @@ namespace AZ
|
||||
//! CalculateBranchToken
|
||||
/*! Calculate the branch token that is used for asset processor connection negotiations
|
||||
*
|
||||
* \param appRootPath - The absolute path of the app root to base the token calculation on
|
||||
* \param engineRootPath - The absolute path to the engine root to base the token calculation on
|
||||
* \param token - The result of the branch token calculation
|
||||
*/
|
||||
void CalculateBranchToken(const AZStd::string& appRootPath, AZStd::string& token);
|
||||
void CalculateBranchToken(AZStd::string_view engineRootPath, AZStd::string& token);
|
||||
void CalculateBranchToken(AZStd::string_view engineRootPath, AZ::IO::FixedMaxPathString& token);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -41,7 +41,6 @@ namespace UnitTest
|
||||
MOCK_METHOD0(GetSerializeContext, AZ::SerializeContext* ());
|
||||
MOCK_METHOD0(GetJsonRegistrationContext, AZ::JsonRegistrationContext* ());
|
||||
MOCK_METHOD0(GetBehaviorContext, AZ::BehaviorContext* ());
|
||||
MOCK_CONST_METHOD0(GetAppRoot, const char* ());
|
||||
MOCK_CONST_METHOD0(GetEngineRoot, const char* ());
|
||||
MOCK_CONST_METHOD0(GetExecutableFolder, const char* ());
|
||||
MOCK_CONST_METHOD1(QueryApplicationType, void(AZ::ApplicationTypeQuery&));
|
||||
|
||||
@@ -59,7 +59,6 @@ namespace UnitTest
|
||||
AZ::SerializeContext* GetSerializeContext() override { return nullptr; }
|
||||
AZ::BehaviorContext* GetBehaviorContext() override { return m_behaviorContext; }
|
||||
AZ::JsonRegistrationContext* GetJsonRegistrationContext() override { return nullptr; }
|
||||
const char* GetAppRoot() const override { return nullptr; }
|
||||
const char* GetEngineRoot() const override { return nullptr; }
|
||||
const char* GetExecutableFolder() const override { return nullptr; }
|
||||
void EnumerateEntities(const EntityCallback& /*callback*/) override {}
|
||||
|
||||
@@ -1060,26 +1060,21 @@ namespace UnitTest
|
||||
/**
|
||||
* UserSettingsComponent test
|
||||
*/
|
||||
class UserSettingsTestApp
|
||||
: public ComponentApplication
|
||||
, public UserSettingsFileLocatorBus::Handler
|
||||
{
|
||||
public:
|
||||
void SetExecutableFolder(const char* path)
|
||||
{
|
||||
m_exeDirectory = path;
|
||||
}
|
||||
|
||||
class UserSettingsTestApp
|
||||
: public ComponentApplication
|
||||
, public UserSettingsFileLocatorBus::Handler
|
||||
{
|
||||
public:
|
||||
AZStd::string ResolveFilePath(u32 providerId) override
|
||||
{
|
||||
AZStd::string filePath;
|
||||
if (providerId == UserSettings::CT_GLOBAL)
|
||||
{
|
||||
filePath = (m_exeDirectory / "GlobalUserSettings.xml").String();
|
||||
filePath = (AZ::IO::Path(GetTestFolderPath()) / "GlobalUserSettings.xml").Native();
|
||||
}
|
||||
else if (providerId == UserSettings::CT_LOCAL)
|
||||
{
|
||||
filePath = (m_exeDirectory / "LocalUserSettings.xml").String();
|
||||
filePath = (AZ::IO::Path(GetTestFolderPath()) / "LocalUserSettings.xml").Native();
|
||||
}
|
||||
return filePath;
|
||||
}
|
||||
@@ -1117,7 +1112,6 @@ namespace UnitTest
|
||||
ComponentApplication::Descriptor appDesc;
|
||||
appDesc.m_memoryBlocksByteSize = 10 * 1024 * 1024;
|
||||
Entity* systemEntity = app.Create(appDesc);
|
||||
app.SetExecutableFolder(GetTestFolderPath().c_str());
|
||||
app.UserSettingsFileLocatorBus::Handler::BusConnect();
|
||||
|
||||
// Make sure user settings file does not exist at this point
|
||||
|
||||
@@ -1240,7 +1240,6 @@ namespace UnitTest
|
||||
SerializeContext* GetSerializeContext() override { return m_serializeContext.get(); }
|
||||
BehaviorContext* GetBehaviorContext() override { return nullptr; }
|
||||
JsonRegistrationContext* GetJsonRegistrationContext() override { return nullptr; }
|
||||
const char* GetAppRoot() const override { return nullptr; }
|
||||
const char* GetEngineRoot() const override { return nullptr; }
|
||||
const char* GetExecutableFolder() const override { return nullptr; }
|
||||
void EnumerateEntities(const EntityCallback& /*callback*/) override {}
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include <AzCore/Module/DynamicModuleHandle.h>
|
||||
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
|
||||
#include <AzCore/StringFunc/StringFunc.h>
|
||||
#include <AzFramework/API/ApplicationAPI.h>
|
||||
#include <AzCore/Utils/Utils.h>
|
||||
#include <AzFramework/IO/LocalFileIO.h>
|
||||
#include <AzToolsFramework/API/EditorAssetSystemAPI.h>
|
||||
#include <AzToolsFramework/Asset/AssetUtils.h>
|
||||
@@ -205,7 +205,7 @@ namespace AzToolsFramework::AssetUtils
|
||||
return platformConfigFilePathsAdded;
|
||||
}
|
||||
|
||||
AZStd::vector<AZ::IO::Path> GetConfigFiles(AZStd::string_view engineRoot, AZStd::string_view assetRoot, AZStd::string_view projectPath,
|
||||
AZStd::vector<AZ::IO::Path> GetConfigFiles(AZStd::string_view engineRoot, AZStd::string_view projectPath,
|
||||
bool addPlatformConfigs, bool addGemsConfigs, AZ::SettingsRegistryInterface* settingsRegistry)
|
||||
{
|
||||
constexpr const char* AssetProcessorGamePlatformConfigFileName = "AssetProcessorGamePlatformConfig.ini";
|
||||
@@ -232,14 +232,13 @@ namespace AzToolsFramework::AssetUtils
|
||||
Internal::AddGemConfigFiles(gemInfoList, configFiles);
|
||||
}
|
||||
|
||||
AZ::IO::Path assetRootDir(assetRoot);
|
||||
assetRootDir /= projectPath;
|
||||
AZ::IO::Path projectRoot(projectPath);
|
||||
|
||||
AZ::IO::Path projectConfigFile = assetRootDir / AssetProcessorGamePlatformConfigFileName;
|
||||
AZ::IO::Path projectConfigFile = projectRoot / AssetProcessorGamePlatformConfigFileName;
|
||||
configFiles.push_back(projectConfigFile);
|
||||
|
||||
// Add a file entry for the Project AssetProcessor setreg file
|
||||
projectConfigFile = assetRootDir / AssetProcessorGamePlatformConfigSetreg;
|
||||
projectConfigFile = projectRoot / AssetProcessorGamePlatformConfigSetreg;
|
||||
configFiles.push_back(projectConfigFile);
|
||||
|
||||
return configFiles;
|
||||
@@ -251,10 +250,10 @@ namespace AzToolsFramework::AssetUtils
|
||||
AZStd::vector<AZStd::string> tokens;
|
||||
AZ::StringFunc::Tokenize(relPathFromRoot.c_str(), tokens, AZ_CORRECT_FILESYSTEM_SEPARATOR_STRING);
|
||||
|
||||
AZStd::string validatedPath;
|
||||
AZ::IO::FixedMaxPath validatedPath;
|
||||
if (rootPath.empty())
|
||||
{
|
||||
AzFramework::ApplicationRequests::Bus::BroadcastResult(validatedPath, &AzFramework::ApplicationRequests::GetEngineRoot);
|
||||
validatedPath = AZ::Utils::GetEnginePath();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -299,10 +298,7 @@ namespace AzToolsFramework::AssetUtils
|
||||
break;
|
||||
}
|
||||
|
||||
AZStd::string absoluteFilePath;
|
||||
AZ::StringFunc::Path::ConstructFull(validatedPath.c_str(), element.c_str(), absoluteFilePath);
|
||||
|
||||
validatedPath = absoluteFilePath; // go one step deeper.
|
||||
validatedPath /= element; // go one step deeper.
|
||||
}
|
||||
|
||||
if (success)
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace AzToolsFramework::AssetUtils
|
||||
//! Also note that if the project has any "game project gems", then those will also be inserted last,
|
||||
//! and thus have a higher priority than the root or non - project gems.
|
||||
//! Also note that the game project could be in a different location to the engine therefore we need the assetRoot param.
|
||||
AZStd::vector<AZ::IO::Path> GetConfigFiles(AZStd::string_view engineRoot, AZStd::string_view assetRoot, AZStd::string_view projectPath,
|
||||
AZStd::vector<AZ::IO::Path> GetConfigFiles(AZStd::string_view engineRoot, AZStd::string_view projectPath,
|
||||
bool addPlatformConfigs = true, bool addGemsConfigs = true, AZ::SettingsRegistryInterface* settingsRegistry = nullptr);
|
||||
|
||||
//! A utility function which checks the given path starting at the root and updates the relative path to be the actual case correct path.
|
||||
|
||||
+4
-6
@@ -9,11 +9,11 @@
|
||||
#include <AzCore/EBus/Results.h>
|
||||
#include <AzCore/std/string/string.h>
|
||||
#include <AzCore/std/containers/vector.h>
|
||||
#include <AzCore/Utils/Utils.h>
|
||||
#include <AzFramework/StringFunc/StringFunc.h>
|
||||
#include <AzToolsFramework/AssetBrowser/AssetBrowserBus.h>
|
||||
#include <AzToolsFramework/API/EditorAssetSystemAPI.h>
|
||||
#include <AzToolsFramework/AssetBrowser/Thumbnails/SourceThumbnail.h>
|
||||
#include <AzFramework/API/ApplicationAPI.h>
|
||||
#include <QString>
|
||||
|
||||
namespace AzToolsFramework
|
||||
@@ -113,11 +113,9 @@ namespace AzToolsFramework
|
||||
|
||||
if (iconPathToUse.isEmpty())
|
||||
{
|
||||
const char* engineRoot = nullptr;
|
||||
AzFramework::ApplicationRequests::Bus::BroadcastResult(engineRoot, &AzFramework::ApplicationRequests::GetEngineRoot);
|
||||
AZ_Assert(engineRoot, "Engine Root not initialized");
|
||||
AZStd::string iconPath = AZStd::string::format("%s%s", engineRoot, DefaultFileIconPath);
|
||||
iconPathToUse = iconPath.c_str();
|
||||
AZ::IO::FixedMaxPath engineRoot = AZ::Utils::GetEnginePath();
|
||||
AZ_Assert(!engineRoot.empty(), "Engine Root not initialized");
|
||||
iconPathToUse = (engineRoot / DefaultFileIconPath).c_str();
|
||||
}
|
||||
|
||||
m_pixmap.load(iconPathToUse);
|
||||
|
||||
+9
-9
@@ -6,10 +6,10 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <AzFramework/StringFunc/StringFunc.h>
|
||||
#include <AzCore/StringFunc/StringFunc.h>
|
||||
#include <AzCore/Utils/Utils.h>
|
||||
#include <AzToolsFramework/Thumbnails/SourceControlThumbnail.h>
|
||||
#include <AzToolsFramework/SourceControl/SourceControlAPI.h>
|
||||
#include <AzFramework/API/ApplicationAPI.h>
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
@@ -68,12 +68,12 @@ namespace AzToolsFramework
|
||||
SourceControlThumbnail::SourceControlThumbnail(SharedThumbnailKey key)
|
||||
: Thumbnail(key)
|
||||
{
|
||||
const char* engineRoot = nullptr;
|
||||
AzFramework::ApplicationRequests::Bus::BroadcastResult(engineRoot, &AzFramework::ApplicationRequests::GetEngineRoot);
|
||||
AZ_Assert(engineRoot, "Engine Root not initialized");
|
||||
AZ::IO::FixedMaxPath engineRoot = AZ::Utils::GetEnginePath();
|
||||
AZ_Assert(!engineRoot.empty(), "Engine Root not initialized");
|
||||
|
||||
m_writableIconPath = (engineRoot / WRITABLE_ICON_PATH).String();
|
||||
m_nonWritableIconPath = (engineRoot / NONWRITABLE_ICON_PATH).String();
|
||||
|
||||
AzFramework::StringFunc::Path::Join(engineRoot, WRITABLE_ICON_PATH, m_writableIconPath);
|
||||
AzFramework::StringFunc::Path::Join(engineRoot, NONWRITABLE_ICON_PATH, m_nonWritableIconPath);
|
||||
|
||||
BusConnect();
|
||||
}
|
||||
@@ -90,8 +90,8 @@ namespace AzToolsFramework
|
||||
AZ_Assert(sourceControlKey, "Incorrect key type, excpected SourceControlThumbnailKey");
|
||||
|
||||
AZStd::string myFileName(sourceControlKey->GetFileName());
|
||||
AzFramework::StringFunc::Path::Normalize(myFileName);
|
||||
if (AzFramework::StringFunc::Equal(myFileName.c_str(), filename))
|
||||
AZ::StringFunc::Path::Normalize(myFileName);
|
||||
if (AZ::StringFunc::Equal(myFileName.c_str(), filename))
|
||||
{
|
||||
Update();
|
||||
}
|
||||
|
||||
@@ -1116,7 +1116,6 @@ namespace UnitTest
|
||||
SerializeContext* GetSerializeContext() override { return m_serializeContext.get(); }
|
||||
BehaviorContext* GetBehaviorContext() override { return nullptr; }
|
||||
JsonRegistrationContext* GetJsonRegistrationContext() override { return nullptr; }
|
||||
const char* GetAppRoot() const override { return nullptr; }
|
||||
const char* GetEngineRoot() const override { return nullptr; }
|
||||
const char* GetExecutableFolder() const override { return nullptr; }
|
||||
void EnumerateEntities(const EntityCallback& /*callback*/) override {}
|
||||
|
||||
@@ -36,11 +36,6 @@ namespace UnitTest
|
||||
: public ComponentApplication
|
||||
{
|
||||
public:
|
||||
void SetExecutableFolder(const char* path)
|
||||
{
|
||||
m_exeDirectory = path;
|
||||
}
|
||||
|
||||
void SetSettingsRegistrySpecializations(SettingsRegistryInterface::Specializations& specializations) override
|
||||
{
|
||||
ComponentApplication::SetSettingsRegistrySpecializations(specializations);
|
||||
|
||||
Reference in New Issue
Block a user