aboutsummaryrefslogtreecommitdiff
path: root/src/wanda/filesystem.cpp
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@gmail.com>2022-09-16 21:36:12 +0200
committerFelix Morgner <felix.morgner@gmail.com>2022-09-16 21:36:12 +0200
commit64922e213ac731279cf3341253e67509adb2dfc8 (patch)
treeddcf4fd5b05ac426ecf032e43e8662c2f9ce0f57 /src/wanda/filesystem.cpp
parentd22bc7b557d36da41fe88d3188a7cd335c3ccaa0 (diff)
downloadwanda-64922e213ac731279cf3341253e67509adb2dfc8.tar.xz
wanda-64922e213ac731279cf3341253e67509adb2dfc8.zip
wanda: restructure source directory
Diffstat (limited to 'src/wanda/filesystem.cpp')
-rw-r--r--src/wanda/filesystem.cpp31
1 files changed, 0 insertions, 31 deletions
diff --git a/src/wanda/filesystem.cpp b/src/wanda/filesystem.cpp
deleted file mode 100644
index 4da30b1..0000000
--- a/src/wanda/filesystem.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-#include <wanda/filesystem.hpp>
-
-#include <random>
-#include <ranges>
-
-namespace wanda
-{
- std::optional<path_list> scan(std::filesystem::path source, bool(filter)(std::filesystem::path const &))
- {
- if (!std::filesystem::is_directory(source))
- {
- return std::nullopt;
- }
- 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)
- {
- static auto generator = std::mt19937{std::random_device{}()};
- auto distribution = std::uniform_int_distribution<std::size_t>{0, paths.size() - 1};
-
- return paths[distribution(generator)];
- }
-
-} // namespace wanda \ No newline at end of file