diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Slice/SliceUtilities.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Slice/SliceUtilities.cpp index 69d4a95b59..c13f7dd848 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Slice/SliceUtilities.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Slice/SliceUtilities.cpp @@ -2651,11 +2651,12 @@ namespace AzToolsFramework AZ::IO::FixedMaxPath lexicallyNormalPath = AZ::IO::PathView(slicePath.toUtf8().constData()).LexicallyNormal(); bool isPathSafeForAssets = false; - for (AZ::IO::Path assetSafeFolder : assetSafeFolders) + for (const AZStd::string& assetSafeFolder : assetSafeFolders) { + 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(assetSafeFolder)) + if (lexicallyNormalPath.IsRelativeTo(assetSafeFolderView)) { isPathSafeForAssets = true; break; diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Prefab/PrefabIntegrationManager.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Prefab/PrefabIntegrationManager.cpp index 0bb596d0f6..7a50961910 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Prefab/PrefabIntegrationManager.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Prefab/PrefabIntegrationManager.cpp @@ -803,11 +803,12 @@ namespace AzToolsFramework AZ::IO::FixedMaxPath lexicallyNormalPath = AZ::IO::PathView(prefabPath.toUtf8().constData()).LexicallyNormal(); bool isPathSafeForAssets = false; - for (AZ::IO::Path assetSafeFolder : assetSafeFolders) + for (const AZStd::string& assetSafeFolder : assetSafeFolders) { + 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(assetSafeFolder)) + if (lexicallyNormalPath.IsRelativeTo(assetSafeFolderView)) { isPathSafeForAssets = true; break;