From 70014f32eca7d138db8fde7c5d0af2f4055f2ac1 Mon Sep 17 00:00:00 2001 From: Joshua Ashton Date: Mon, 6 Nov 2023 21:47:59 +0000 Subject: [PATCH] Sort files by alphabetical order in color tester --- src/Apps/Tools/ColorTester.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/Apps/Tools/ColorTester.cpp b/src/Apps/Tools/ColorTester.cpp index 8250299..d0af0f9 100644 --- a/src/Apps/Tools/ColorTester.cpp +++ b/src/Apps/Tools/ColorTester.cpp @@ -210,15 +210,26 @@ int main(int argc, char** argv) }; Vector imageUploads; Vector imageIsHDR; - if (std::filesystem::exists("images")) + if (!std::filesystem::exists("images")) { + log::err("No image directory!"); + return 1; + } + { + Vector filenames; + for (const auto &entry : std::filesystem::directory_iterator("images")) + filenames.push_back(std::string(entry.path())); + + std::sort(filenames.begin(), filenames.end(), [](const auto& a, const auto& b) { return a < b; }); + + for (auto& entry : filenames) { - std::cout << entry.path() << std::endl; + std::cout << entry << std::endl; bool imageHDR = true;//std::string(entry.path()).find(".pq.") != std::string::npos; - auto r_pngData = fs::OpenFileIntoBuffer(entry.path().c_str()); + auto r_pngData = fs::OpenFileIntoBuffer(entry.c_str()); if (!r_pngData) continue;