Merge pull request #4838 from aws-lumberyard-dev/LYN-7562

Make safe asset folder comparison for prefab creation to be case insensitive
monroegm-disable-blank-issue-2
Nicholas Van Sickle 4 years ago committed by GitHub
commit f3af362ede
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -2648,16 +2648,15 @@ namespace AzToolsFramework
}
else
{
QString cleanSaveAs(QDir::cleanPath(slicePath));
AZ::IO::FixedMaxPath lexicallyNormalPath = AZ::IO::PathView(slicePath.toUtf8().constData()).LexicallyNormal();
bool isPathSafeForAssets = false;
for (AZStd::string assetSafeFolder : assetSafeFolders)
for (const AZStd::string& assetSafeFolder : assetSafeFolders)
{
QString cleanAssetSafeFolder(QDir::cleanPath(assetSafeFolder.c_str()));
// Compare using clean paths so slash direction does not matter.
// Note that this comparison is case sensitive because some file systems
// Open 3D Engine supports are case sensitive.
if (cleanSaveAs.startsWith(cleanAssetSafeFolder))
AZ::IO::PathView assetSafeFolderView(assetSafeFolder);
// Check if the slice path is relative to the safe asset directory.
// The Path classes are being used to make this check case insensitive.
if (lexicallyNormalPath.IsRelativeTo(assetSafeFolderView))
{
isPathSafeForAssets = true;
break;

@ -805,16 +805,15 @@ namespace AzToolsFramework
}
else
{
QString cleanSaveAs(QDir::cleanPath(prefabPath));
AZ::IO::FixedMaxPath lexicallyNormalPath = AZ::IO::PathView(prefabPath.toUtf8().constData()).LexicallyNormal();
bool isPathSafeForAssets = false;
for (AZStd::string assetSafeFolder : assetSafeFolders)
for (const AZStd::string& assetSafeFolder : assetSafeFolders)
{
QString cleanAssetSafeFolder(QDir::cleanPath(assetSafeFolder.c_str()));
// Compare using clean paths so slash direction does not matter.
// Note that this comparison is case sensitive because some file systems
// Open 3D Engine supports are case sensitive.
if (cleanSaveAs.startsWith(cleanAssetSafeFolder))
AZ::IO::PathView assetSafeFolderView(assetSafeFolder);
// Check if the prefabPath is relative to the safe asset directory.
// The Path classes are being used to make this check case insensitive.
if (lexicallyNormalPath.IsRelativeTo(assetSafeFolderView))
{
isPathSafeForAssets = true;
break;

Loading…
Cancel
Save