aboutsummaryrefslogtreecommitdiff
path: root/src/wanda/filesystem.cpp
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@gmail.com>2021-02-10 12:27:49 +0100
committerFelix Morgner <felix.morgner@gmail.com>2021-02-10 12:27:49 +0100
commit4fc2b7acffb9699c3ef4fbe5027124e589735be0 (patch)
treef9582797e1f0fe8fc1a80c657d55a7af0fce0a52 /src/wanda/filesystem.cpp
parent13b66c3074cbc6e502e97a76993f513a58e21f08 (diff)
downloadwanda-4fc2b7acffb9699c3ef4fbe5027124e589735be0.tar.xz
wanda-4fc2b7acffb9699c3ef4fbe5027124e589735be0.zip
wanda: port to standard ranges
Diffstat (limited to 'src/wanda/filesystem.cpp')
-rw-r--r--src/wanda/filesystem.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/wanda/filesystem.cpp b/src/wanda/filesystem.cpp
index d94894a..4da30b1 100644
--- a/src/wanda/filesystem.cpp
+++ b/src/wanda/filesystem.cpp
@@ -1,8 +1,7 @@
#include <wanda/filesystem.hpp>
-#include <range/v3/all.hpp>
-
#include <random>
+#include <ranges>
namespace wanda
{
@@ -12,10 +11,13 @@ namespace wanda
{
return std::nullopt;
}
-
- auto begin = std::filesystem::recursive_directory_iterator{source};
- auto end = std::filesystem::recursive_directory_iterator{};
- return ranges::make_iterator_range(begin, end) | ranges::view::filter(filter);
+ auto entries = std::filesystem::recursive_directory_iterator{source};
+ auto result = path_list{};
+ for (auto & entry : entries | std::views::filter(filter))
+ {
+ result.push_back(entry.path());
+ }
+ return result;
}
std::filesystem::path random_pick(path_list const & paths)