Fixed get type from extension bug in asset handler

This commit is contained in:
Xiao Qi 2022-11-11 10:47:03 +08:00
parent e824c17405
commit 6df3f3d417
2 changed files with 3 additions and 1 deletions

View File

@ -102,6 +102,8 @@ constexpr std::string_view EXTENSIONS[] = {
AUDIO_WAV_EXTENSION, AUDIO_WAV_EXTENSION,
}; };
constexpr size_t EXTENSIONS_COUNT{ 11 };
// EXTERNAL EXTENSIONS // EXTERNAL EXTENSIONS
constexpr std::string_view GLSL_EXTENSION{ ".glsl" }; constexpr std::string_view GLSL_EXTENSION{ ".glsl" };
constexpr std::string_view DDS_EXTENSION{ ".dds" }; constexpr std::string_view DDS_EXTENSION{ ".dds" };

View File

@ -38,7 +38,7 @@ namespace SHADE
****************************************************************************/ ****************************************************************************/
AssetType SHAssetMetaHandler::GetTypeFromExtension(AssetExtension ext) noexcept AssetType SHAssetMetaHandler::GetTypeFromExtension(AssetExtension ext) noexcept
{ {
for (int i{0}; i < EXTENSIONS->size(); ++i) for (auto i{0}; i < EXTENSIONS_COUNT; ++i)
{ {
if (strcmp(ext.c_str(), EXTENSIONS[i].data()) == 0) if (strcmp(ext.c_str(), EXTENSIONS[i].data()) == 0)
{ {