FixedMaxPathString replacement

Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
This commit is contained in:
Esteban Papp
2021-08-05 19:25:26 -07:00
parent 0dc829891a
commit 84623dfb66
9 changed files with 23 additions and 23 deletions
+2 -2
View File
@@ -210,7 +210,7 @@ namespace
const char* PyGetCurrentLevelName()
{
// Using static member to capture temporary data
static AZStd::fixed_string<AZ::IO::MaxPathLength> tempLevelName;
static AZ::IO::FixedMaxPathString tempLevelName;
tempLevelName = GetIEditor()->GetGameEngine()->GetLevelName().toUtf8().data();
return tempLevelName.c_str();
}
@@ -218,7 +218,7 @@ namespace
const char* PyGetCurrentLevelPath()
{
// Using static member to capture temporary data
static AZStd::fixed_string<AZ::IO::MaxPathLength> tempLevelPath;
static AZ::IO::FixedMaxPathString tempLevelPath;
tempLevelPath = GetIEditor()->GetGameEngine()->GetLevelPath().toUtf8().data();
return tempLevelPath.c_str();
}
+1 -1
View File
@@ -246,7 +246,7 @@ namespace Path
AZStd::string GetEditingGameDataFolder()
{
// Define here the mod name
static AZStd::fixed_string<AZ::IO::MaxPathLength> s_currentModName;
static AZ::IO::FixedMaxPathString s_currentModName;
if (s_currentModName.empty())
{
@@ -418,7 +418,7 @@ namespace UnitTest
// Check each operator/= and append overload for success
{
AZStd::fixed_string<AZ::IO::MaxPathLength> pathString{ "foo" };
AZ::IO::FixedMaxPathString pathString{ "foo" };
AZ::IO::FixedMaxPath testPath('/');
testPath /= AZ::IO::PathView(pathString);
testPath /= pathString;
@@ -428,7 +428,7 @@ namespace UnitTest
EXPECT_STREQ("foo/foo/foo/foo/f", testPath.c_str());
}
{
AZStd::fixed_string<AZ::IO::MaxPathLength> pathString{ "foo" };
AZ::IO::FixedMaxPathString pathString{ "foo" };
AZ::IO::FixedMaxPath testPath('/');
testPath.Append(AZ::IO::PathView(pathString));
testPath.Append(pathString);
@@ -94,7 +94,7 @@ namespace AZ::IO::ArchiveInternal
}
return convertedPath;
}
return AZStd::make_optional<AZStd::fixed_string<AZ::IO::MaxPathLength>>(sourcePath);
return AZStd::make_optional<AZ::IO::FixedMaxPathString>(sourcePath);
}
struct CCachedFileRawData
@@ -614,7 +614,7 @@ namespace AZ::IO
const char* Archive::AdjustFileName(AZStd::string_view src, char* dst, size_t dstSize, uint32_t, bool)
{
AZStd::fixed_string<AZ::IO::MaxPathLength> srcPath{ src };
AZ::IO::FixedMaxPathString srcPath{ src };
return AZ::IO::FileIOBase::GetDirectInstance()->ResolvePath(srcPath.c_str(), dst, dstSize) ? dst : nullptr;
}
@@ -2407,14 +2407,14 @@ namespace AZ::IO
//////////////////////////////////////////////////////////////////////////
bool Archive::RemoveFile(AZStd::string_view pName)
{
AZStd::fixed_string<AZ::IO::MaxPathLength> szFullPath{ pName };
AZ::IO::FixedMaxPathString szFullPath{ pName };
return AZ::IO::FileIOBase::GetDirectInstance()->Remove(szFullPath.c_str()) == AZ::IO::ResultCode::Success;
}
//////////////////////////////////////////////////////////////////////////
bool Archive::RemoveDir(AZStd::string_view pName)
{
AZStd::fixed_string<AZ::IO::MaxPathLength> szFullPath{ pName };
AZ::IO::FixedMaxPathString szFullPath{ pName };
if (AZ::IO::FileIOBase::GetDirectInstance()->IsDirectory(szFullPath.c_str()))
{
@@ -30,7 +30,7 @@ namespace AZ::IO
struct INestedArchive;
struct IArchive;
using PathString = AZStd::fixed_string<AZ::IO::MaxPathLength>;
using PathString = AZ::IO::FixedMaxPathString;
using StackString = AZStd::fixed_string<512>;
struct MemoryBlock;
@@ -41,7 +41,7 @@ namespace AZ::IO
return ZipDir::ZD_ERROR_INVALID_CALL;
}
AZStd::fixed_string<AZ::IO::MaxPathLength> fullPath = AdjustPath(szRelativePath);
AZ::IO::FixedMaxPathString fullPath = AdjustPath(szRelativePath);
if (fullPath.empty())
{
return ZipDir::ZD_ERROR_INVALID_PATH;
@@ -63,7 +63,7 @@ namespace AZ::IO
return ZipDir::ZD_ERROR_INVALID_CALL;
}
AZStd::fixed_string<AZ::IO::MaxPathLength> fullPath = AdjustPath(szRelativePath);
AZ::IO::FixedMaxPathString fullPath = AdjustPath(szRelativePath);
if (fullPath.empty())
{
return ZipDir::ZD_ERROR_INVALID_PATH;
@@ -81,7 +81,7 @@ namespace AZ::IO
return ZipDir::ZD_ERROR_INVALID_CALL;
}
AZStd::fixed_string<AZ::IO::MaxPathLength> fullPath = AdjustPath(szRelativePath);
AZ::IO::FixedMaxPathString fullPath = AdjustPath(szRelativePath);
if (fullPath.empty())
{
return ZipDir::ZD_ERROR_INVALID_PATH;
@@ -105,7 +105,7 @@ namespace AZ::IO
return ZipDir::ZD_ERROR_INVALID_CALL;
}
AZStd::fixed_string<AZ::IO::MaxPathLength> fullPath = AdjustPath(szRelativePath);
AZ::IO::FixedMaxPathString fullPath = AdjustPath(szRelativePath);
if (fullPath.empty())
{
return ZipDir::ZD_ERROR_INVALID_PATH;
@@ -122,7 +122,7 @@ namespace AZ::IO
return ZipDir::ZD_ERROR_INVALID_CALL;
}
AZStd::fixed_string<AZ::IO::MaxPathLength> fullPath = AdjustPath(szRelativePath);
AZ::IO::FixedMaxPathString fullPath = AdjustPath(szRelativePath);
if (fullPath.empty())
{
return ZipDir::ZD_ERROR_INVALID_PATH;
@@ -141,7 +141,7 @@ namespace AZ::IO
return ZipDir::ZD_ERROR_INVALID_CALL;
}
AZStd::fixed_string<AZ::IO::MaxPathLength> fullPath = AdjustPath(szRelativePath);
AZ::IO::FixedMaxPathString fullPath = AdjustPath(szRelativePath);
if (fullPath.empty())
{
return ZipDir::ZD_ERROR_INVALID_PATH;
@@ -152,7 +152,7 @@ namespace AZ::IO
// finds the file; you don't have to close the returned handle
auto NestedArchive::FindFile(AZStd::string_view szRelativePath) -> Handle
{
AZStd::fixed_string<AZ::IO::MaxPathLength> fullPath = AdjustPath(szRelativePath);
AZ::IO::FixedMaxPathString fullPath = AdjustPath(szRelativePath);
if (fullPath.empty())
{
return nullptr;
@@ -249,7 +249,7 @@ namespace AZ::IO
if (m_nFlags & FLAGS_RELATIVE_PATHS_ONLY)
{
return AZStd::fixed_string<AZ::IO::MaxPathLength>{ szRelativePath };
return AZ::IO::FixedMaxPathString{ szRelativePath };
}
if ((szRelativePath.size() > 1 && szRelativePath[1] == ':') || (m_nFlags & FLAGS_ABSOLUTE_PATHS))
@@ -440,7 +440,7 @@ namespace AZ::IO::ZipDir
azstrcpy(volume, AZ_ARRAY_SIZE(volume), filename);
}
AZStd::fixed_string<AZ::IO::MaxPathLength> drive{ AZ::IO::PathView(volume).RootName().Native() };
AZ::IO::FixedMaxPathString drive{ AZ::IO::PathView(volume).RootName().Native() };
if (drive.empty())
{
return false;
@@ -195,7 +195,7 @@ namespace AssetProcessor
AZ::IO::Path currentFullFolderPath;
const AZ::IO::PathView filename = productNamePath.Filename();
const AZ::IO::PathView fullPathWithoutFilename = productNamePath.RemoveFilename();
AZStd::fixed_string<AZ::IO::MaxPathLength> currentPath;
AZ::IO::FixedMaxPathString currentPath;
for (auto pathIt = fullPathWithoutFilename.begin(); pathIt != fullPathWithoutFilename.end(); ++pathIt)
{
currentPath = pathIt->FixedMaxPathString();
@@ -236,7 +236,7 @@ namespace AssetProcessor
}
AZStd::shared_ptr<ProductAssetTreeItemData> productItemData =
ProductAssetTreeItemData::MakeShared(&product, product.m_productName, AZStd::fixed_string<AZ::IO::MaxPathLength>(filename.Native()).c_str(), false, sourceId);
ProductAssetTreeItemData::MakeShared(&product, product.m_productName, AZ::IO::FixedMaxPathString(filename.Native()).c_str(), false, sourceId);
m_productToTreeItem[product.m_productName] =
parentItem->CreateChild(productItemData);
m_productIdToTreeItem[product.m_productID] = m_productToTreeItem[product.m_productName];
@@ -94,7 +94,7 @@ namespace AssetProcessor
AZ::IO::Path currentFullFolderPath(AZ::IO::PosixPathSeparator);
const AZ::IO::FixedMaxPath filename = fullPath.Filename();
fullPath.RemoveFilename();
AZStd::fixed_string<AZ::IO::MaxPathLength> currentPath;
AZ::IO::FixedMaxPathString currentPath;
for (auto pathIt = fullPath.begin(); pathIt != fullPath.end(); ++pathIt)
{
currentPath = pathIt->FixedMaxPathString();
@@ -125,7 +125,7 @@ namespace AssetProcessor
}
m_sourceToTreeItem[source.m_sourceName] =
parentItem->CreateChild(SourceAssetTreeItemData::MakeShared(&source, &scanFolder, source.m_sourceName, AZStd::fixed_string<AZ::IO::MaxPathLength>(filename.Native()).c_str(), false));
parentItem->CreateChild(SourceAssetTreeItemData::MakeShared(&source, &scanFolder, source.m_sourceName, AZ::IO::FixedMaxPathString(filename.Native()).c_str(), false));
m_sourceIdToTreeItem[source.m_sourceID] = m_sourceToTreeItem[source.m_sourceName];
if (!modelIsResetting)
{