diff options
| author | Felix Morgner <felix.morgner@gmail.com> | 2024-05-17 17:58:38 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@gmail.com> | 2024-05-17 17:58:38 +0200 |
| commit | 577fc0845718ed8ad5bebf02a277c0579a817f77 (patch) | |
| tree | 3d1cdc53c426a0ba60a7996619a7b787850bb3b3 /source/lib/system/src/filesystem.cpp | |
| parent | de5bf7ca3b7a2bf6be35b86486b00dc6a071b950 (diff) | |
| download | wanda-577fc0845718ed8ad5bebf02a277c0579a817f77.tar.xz wanda-577fc0845718ed8ad5bebf02a277c0579a817f77.zip | |
Diffstat (limited to 'source/lib/system/src/filesystem.cpp')
| -rw-r--r-- | source/lib/system/src/filesystem.cpp | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/source/lib/system/src/filesystem.cpp b/source/lib/system/src/filesystem.cpp deleted file mode 100644 index 04dfff3..0000000 --- a/source/lib/system/src/filesystem.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include "wanda/system/filesystem.hpp" - -#include <random> -#include <ranges> - -namespace wanda::system -{ - 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::system
\ No newline at end of file |
