Skip to content

Commit 8cd8cc2

Browse files
author
James Johnson
committed
Fix for globbing binary glTF files.
1 parent 86c2fb5 commit 8cd8cc2

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Samples/GLTFViewer/src/GLTFViewer.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,16 @@ void GLTFViewer::UpdateModelsList(const std::string& Dir)
257257
#if PLATFORM_WIN32 || PLATFORM_LINUX || PLATFORM_MACOS
258258
if (!Dir.empty())
259259
{
260-
FileSystem::SearchFilesResult SearchRes = FileSystem::SearchRecursive(Dir.c_str(), "*.gltf");
261-
for (const auto& File : SearchRes)
260+
FileSystem::SearchFilesResult SearchRes{};
261+
for (const char* pattern : {"*.glb", "*.gltf"})
262+
{
263+
FileSystem::SearchFilesResult CurrentSearchRes = FileSystem::SearchRecursive(Dir.c_str(), pattern);
264+
std::move(CurrentSearchRes.begin(), CurrentSearchRes.end(), std::back_inserter(SearchRes));
265+
}
266+
std::sort(SearchRes.begin(), SearchRes.end(), [](const FindFileData& lhs, const FindFileData& rhs) -> bool {
267+
return lhs.Name < rhs.Name;
268+
});
269+
for (const FindFileData& File : SearchRes)
262270
{
263271
m_Models.push_back(ModelInfo{File.Name, Dir + FileSystem::SlashSymbol + File.Name});
264272
}

0 commit comments

Comments
 (0)