diff options
| author | Felix Morgner <felix.morgner@gmail.com> | 2018-12-11 07:42:05 +0100 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@gmail.com> | 2018-12-11 07:42:05 +0100 |
| commit | ed419140280553b070943b7ba539120a26ff5686 (patch) | |
| tree | 3d134977a6dfae71a45c318305166d044b50320d /src/filesystem.cpp | |
| parent | d3e691c9200b7b782c8acf17468068a699588a73 (diff) | |
| download | wanda-ed419140280553b070943b7ba539120a26ff5686.tar.xz wanda-ed419140280553b070943b7ba539120a26ff5686.zip | |
wanda: restructure directory hierarchy
Diffstat (limited to 'src/filesystem.cpp')
| -rw-r--r-- | src/filesystem.cpp | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/src/filesystem.cpp b/src/filesystem.cpp deleted file mode 100644 index bb724d1..0000000 --- a/src/filesystem.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#include "filesystem.hpp" - -#include <boost/iterator/filter_iterator.hpp> - -#include <random> - -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 first = boost::make_filter_iterator(filter, std::filesystem::recursive_directory_iterator{source}); - auto last = boost::make_filter_iterator(filter, std::filesystem::recursive_directory_iterator{}); - return path_list{first, last}; - } - - 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 |
