File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -1103,10 +1103,19 @@ bool load_images_from_dir(const std::string dir,
11031103 return false ;
11041104 }
11051105
1106+ std::vector<fs::directory_entry> entries;
11061107 for (const auto & entry : fs::directory_iterator (dir)) {
1107- if (!entry.is_regular_file ())
1108- continue ;
1108+ if (entry.is_regular_file ()) {
1109+ entries.push_back (entry);
1110+ }
1111+ }
1112+
1113+ std::sort (entries.begin (), entries.end (),
1114+ [](const fs::directory_entry& a, const fs::directory_entry& b) {
1115+ return a.path ().filename ().string () < b.path ().filename ().string ();
1116+ });
11091117
1118+ for (const auto & entry : entries) {
11101119 std::string path = entry.path ().string ();
11111120 std::string ext = entry.path ().extension ().string ();
11121121 std::transform (ext.begin (), ext.end (), ext.begin (), ::tolower);
You can’t perform that action at this time.
0 commit comments