Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions examples/cli/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1103,10 +1103,19 @@ bool load_images_from_dir(const std::string dir,
return false;
}

std::vector<fs::directory_entry> entries;
for (const auto& entry : fs::directory_iterator(dir)) {
if (!entry.is_regular_file())
continue;
if (entry.is_regular_file()) {
entries.push_back(entry);
}
}

std::sort(entries.begin(), entries.end(),
[](const fs::directory_entry& a, const fs::directory_entry& b) {
return a.path().filename().string() < b.path().filename().string();
});

for (const auto& entry : entries) {
std::string path = entry.path().string();
std::string ext = entry.path().extension().string();
std::transform(ext.begin(), ext.end(), ext.begin(), ::tolower);
Expand Down
Loading