mirror of
https://github.com/cemu-project/vcpkg.git
synced 2025-02-23 11:07:10 +01:00
Add Files::has_invalid_chars_for_filesystem()
This commit is contained in:
parent
c7a7d062a7
commit
1cd1f6a46b
@ -5,8 +5,12 @@
|
||||
|
||||
namespace vcpkg {namespace Files
|
||||
{
|
||||
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<std::string> 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);
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user