aboutsummaryrefslogtreecommitdiff
path: root/source/src/wanda/filesystem.cpp
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@gmail.com>2022-09-16 23:28:09 +0200
committerFelix Morgner <felix.morgner@gmail.com>2022-09-16 23:28:09 +0200
commitf4d9880d3c9555b48affad727589ef5c093b1841 (patch)
treea5552b5a33000a527748ac1c72ca366476af0936 /source/src/wanda/filesystem.cpp
parent64922e213ac731279cf3341253e67509adb2dfc8 (diff)
downloadwanda-f4d9880d3c9555b48affad727589ef5c093b1841.tar.xz
wanda-f4d9880d3c9555b48affad727589ef5c093b1841.zip
source: clean up structure
Diffstat (limited to 'source/src/wanda/filesystem.cpp')
-rw-r--r--source/src/wanda/filesystem.cpp31
1 files changed, 0 insertions, 31 deletions
diff --git a/source/src/wanda/filesystem.cpp b/source/src/wanda/filesystem.cpp
deleted file mode 100644
index 4da30b1..0000000
--- a/source/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