From 129d06597d7da59acaa09d7a28abd438996b48ba Mon Sep 17 00:00:00 2001 From: coco875 Date: Fri, 16 May 2025 23:14:40 +0200 Subject: fix wrong order of file --- src/utils/TorchUtils.cpp | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) (limited to 'src/utils/TorchUtils.cpp') diff --git a/src/utils/TorchUtils.cpp b/src/utils/TorchUtils.cpp index 497b545..bf8b92a 100644 --- a/src/utils/TorchUtils.cpp +++ b/src/utils/TorchUtils.cpp @@ -27,22 +27,12 @@ int getFileDepth(const fs::path& base, const fs::path& p) { } std::vector Torch::getRecursiveEntries(const fs::path baseDir) { - std::vector result; + std::set result; for (const auto& entry : fs::recursive_directory_iterator(baseDir)) { - result.push_back(entry); + result.insert(entry); } - std::sort(result.begin(), result.end(), [](const fs::directory_entry& a, const fs::directory_entry& b) { - std::string nameA = a.path().parent_path().string(); - std::string nameB = b.path().parent_path().string(); - int depthA = std::distance(a.path().begin(), a.path().end()); - int depthB = std::distance(b.path().begin(), b.path().end()); - - if (nameA != nameB) - return nameA < nameB; - return depthA < depthB; - }); - - return result; + std::vector sortedEntries(result.begin(), result.end()); + return sortedEntries; } \ No newline at end of file -- cgit v1.2.3