#pragma once #include "expected.h" #include #include namespace vcpkg {namespace Files { namespace fs = std::tr2::sys; static const char* FILESYSTEM_INVALID_CHARACTERS = R"(\/:*?"<>|)"; void check_is_directory(const std::tr2::sys::path& dirpath); bool has_invalid_chars_for_filesystem(const std::string s); expected get_contents(const std::tr2::sys::path& file_path) noexcept; std::tr2::sys::path find_file_recursively_up(const std::tr2::sys::path& starting_dir, const std::string& filename); template void non_recursive_find_matching_paths_in_dir(const fs::path& dir, const Pred predicate, std::vector* output) { std::copy_if(fs::directory_iterator(dir), fs::directory_iterator(), std::back_inserter(*output), predicate); } template void recursive_find_matching_paths_in_dir(const fs::path& dir, const Pred predicate, std::vector* output) { std::copy_if(fs::recursive_directory_iterator(dir), fs::recursive_directory_iterator(), std::back_inserter(*output), predicate); } template std::vector recursive_find_matching_paths_in_dir(const fs::path& dir, const Pred predicate) { std::vector v; recursive_find_matching_paths_in_dir(dir, predicate, &v); return v; } void recursive_find_files_with_extension_in_dir(const fs::path& dir, const std::string& extension, std::vector* output); std::vector recursive_find_files_with_extension_in_dir(const fs::path& dir, const std::string& extension); }}