diff options
Diffstat (limited to 'toolsrc/src/vcpkg_Files.cpp')
| -rw-r--r-- | toolsrc/src/vcpkg_Files.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/toolsrc/src/vcpkg_Files.cpp b/toolsrc/src/vcpkg_Files.cpp index ef330ea27..611aa7450 100644 --- a/toolsrc/src/vcpkg_Files.cpp +++ b/toolsrc/src/vcpkg_Files.cpp @@ -1,16 +1,24 @@ #include "vcpkg_Files.h" #include <fstream> #include <filesystem> +#include <regex> namespace fs = std::tr2::sys; namespace vcpkg {namespace Files { + static const std::regex FILESYSTEM_INVALID_CHARACTERS_REGEX = std::regex(R"([\/:*?"<>|])"); + void check_is_directory(const fs::path& dirpath) { Checks::check_throw(fs::is_directory(dirpath), "The path %s is not a directory", dirpath.string()); } + bool has_invalid_chars_for_filesystem(const std::string s) + { + return std::regex_search(s, FILESYSTEM_INVALID_CHARACTERS_REGEX); + } + expected<std::string> get_contents(const fs::path& file_path) noexcept { std::fstream file_stream(file_path, std::ios_base::in | std::ios_base::binary); |
