Integrating latest from github/staging

Integrating up through commit 5e1bdae
This commit is contained in:
alexpete
2021-03-26 14:31:50 -07:00
parent 9c54341af8
commit 36c4e827bd
764 changed files with 11453 additions and 20251 deletions
@@ -18,6 +18,7 @@
#include <AzCore/Casting/lossy_cast.h>
#include <AzCore/std/functional.h>
#include <AzCore/std/string/conversions.h>
#include <AzCore/StringFunc/StringFunc.h>
#include <cctype>
namespace AZ
@@ -479,10 +480,9 @@ namespace AZ
azstrncpy(resolvedPath, resolvedPathSize, path, pathLen + 1);
//see if the absolute path uses @assets@ or @root@, if it does lowercase the relative part
if (!LowerIfBeginsWith(resolvedPath, resolvedPathSize, GetAlias("@assets@")))
{
LowerIfBeginsWith(resolvedPath, resolvedPathSize, GetAlias("@root@"));
}
[[maybe_unused]] bool lowercasePath = LowerIfBeginsWith(resolvedPath, resolvedPathSize, GetAlias("@assets@"))
|| LowerIfBeginsWith(resolvedPath, resolvedPathSize, GetAlias("@root@"))
|| LowerIfBeginsWith(resolvedPath, resolvedPathSize, GetAlias("@projectplatformcache@"));
ToUnixSlashes(resolvedPath, resolvedPathSize);
return true;
@@ -707,10 +707,9 @@ namespace AZ
size_t keyLen = alias.first.length();
if (azstrnicmp(resolvedPath, key, keyLen) == 0) // we only support aliases at the front of the path
{
if(azstrnicmp(key, "@assets@", 8) == 0 || azstrnicmp(key, "@root@", 6) == 0)
{
AZStd::to_lower(resolvedPath, resolvedPath + resolvedPathSize);
}
[[maybe_unused]] bool lowercasePath = LowerIfBeginsWith(resolvedPath, resolvedPathSize, "@assets@")
|| LowerIfBeginsWith(resolvedPath, resolvedPathSize, "@root@")
|| LowerIfBeginsWith(resolvedPath, resolvedPathSize, "@projectplatformcache@");
const char* dest = alias.second.c_str();
size_t destLen = alias.second.length();
@@ -742,6 +741,44 @@ namespace AZ
return false;
}
bool LocalFileIO::ReplaceAlias(AZ::IO::FixedMaxPath& replacedAliasPath, const AZ::IO::PathView& path) const
{
if (path.empty())
{
replacedAliasPath = path;
return true;
}
AZStd::string_view pathStrView = path.Native();
for (const auto& [aliasKey, aliasValue] : m_aliases)
{
if (AZ::StringFunc::StartsWith(pathStrView, aliasKey))
{
// Reduce of the size result result path by the size of the and add the resolved alias size
AZStd::string_view postAliasView = pathStrView.substr(aliasKey.size());
size_t requiredFixedMaxPathSize = postAliasView.size();
requiredFixedMaxPathSize += aliasValue.size();
// The replaced alias path is greater than 1024 characters, return false
if (requiredFixedMaxPathSize > replacedAliasPath.Native().max_size())
{
return false;
}
replacedAliasPath.Native() = AZ::IO::FixedMaxPathString(AZStd::string_view{ aliasValue });
replacedAliasPath.Native() += postAliasView;
return true;
}
}
if (pathStrView.size() > replacedAliasPath.Native().max_size())
{
return false;
}
replacedAliasPath = path;
return true;
}
bool LocalFileIO::GetFilename(HandleType fileHandle, char* filename, AZ::u64 filenameSize) const
{
AZStd::lock_guard<AZStd::recursive_mutex> lock(m_openFileGuard);
@@ -75,6 +75,7 @@ namespace AZ
bool ResolvePath(const char* path, char* resolvedPath, AZ::u64 resolvedPathSize) const override;
bool ResolvePath(AZ::IO::FixedMaxPath& resolvedPath, const AZ::IO::PathView& path) const override;
using FileIOBase::ResolvePath;
bool ReplaceAlias(AZ::IO::FixedMaxPath& replacedAliasPath, const AZ::IO::PathView& path) const override;
bool GetFilename(HandleType fileHandle, char* filename, AZ::u64 filenameSize) const override;
bool ConvertToAbsolutePath(const char* path, char* absolutePath, AZ::u64 maxLength) const;
@@ -830,6 +830,15 @@ namespace AZ
return false;
}
bool NetworkFileIO::ReplaceAlias([[maybe_unused]] AZ::IO::FixedMaxPath& replaceAliasPath, [[maybe_unused]] const AZ::IO::PathView& path) const
{
REMOTEFILE_LOG_CALL(AZStd::string::format("NetworkFileIO()::ReplaceAlias(path=%.*s)",
aznumeric_cast<int>(path.Native().size()), path.Native.data()).c_str());
REMOTEFILE_LOG_APPEND(AZStd::string::format("NetworkFileIO::ReplaceAlias(path=%.*s) return false",
aznumeric_cast<int>(path.Native().size()), path.Native().data()).c_str());
return false;
}
bool NetworkFileIO::GetFilename(HandleType fileHandle, char* filename, AZ::u64 filenameSize) const
{
REMOTEFILE_LOG_CALL(AZStd::string::format("NetworkFileIO()::GetFilename(fileHandle=%u, filename=%s, filenamesize=%u)", fileHandle, filename?filename:"nullptr", filenameSize).c_str());
@@ -1388,6 +1397,11 @@ namespace AZ
return m_excludedFileIO ? m_excludedFileIO->ResolvePath(resolvedPath, path) : false;
}
bool RemoteFileIO::ReplaceAlias(AZ::IO::FixedMaxPath& replaceAliasPath, const AZ::IO::PathView& path) const
{
return m_excludedFileIO ? m_excludedFileIO->ReplaceAlias(replaceAliasPath, path) : false;
}
#ifdef REMOTEFILEIO_CACHE_FILETREE
bool RemoteFileIO::Exists(const char* filePath)
{
@@ -113,6 +113,7 @@ namespace AZ
bool ResolvePath(const char* path, char* resolvedPath, AZ::u64 resolvedPathSize) const override;
bool ResolvePath(AZ::IO::FixedMaxPath& resolvedPath, const AZ::IO::PathView& path) const override;
using FileIOBase::ResolvePath;
bool ReplaceAlias(AZ::IO::FixedMaxPath& replacedAliasPath, const AZ::IO::PathView& path) const override;
bool GetFilename(HandleType fileHandle, char* filename, AZ::u64 filenameSize) const override;
bool IsRemoteIOEnabled() override;
////////////////////////////////////////////////////////////////////////////////////////////
@@ -203,6 +204,7 @@ namespace AZ
bool ResolvePath(const char* path, char* resolvedPath, AZ::u64 resolvedPathSize) const override;
bool ResolvePath(AZ::IO::FixedMaxPath& resolvedPath, const AZ::IO::PathView& path) const override;
using FileIOBase::ResolvePath;
bool ReplaceAlias(AZ::IO::FixedMaxPath& replacedAliasPath, const AZ::IO::PathView& path) const override;
#ifdef REMOTEFILEIO_CACHE_FILETREE
bool Exists(const char* filePath) override;