Remove Files::check_is_directory()

This commit is contained in:
Robert Schumacher 2017-03-31 17:57:45 -07:00 committed by Alexander Karatarakis
parent 4e26c6781c
commit 9b9a35fa38
3 changed files with 10 additions and 11 deletions

View File

@ -8,8 +8,6 @@ namespace vcpkg::Files
{
static const char* FILESYSTEM_INVALID_CHARACTERS = R"(\/:*?"<>|)";
void check_is_directory(const LineInfo& line_info, const fs::path& dirpath);
bool has_invalid_chars_for_filesystem(const std::string& s);
expected<std::string> read_contents(const fs::path& file_path) noexcept;

View File

@ -12,9 +12,15 @@ namespace vcpkg::Commands::Import
std::vector<fs::path> libs;
};
void check_is_directory(const LineInfo& line_info, const fs::path& dirpath)
{
Checks::check_exit(line_info, fs::is_directory(dirpath), "The path %s is not a directory", dirpath.string());
}
static Binaries find_binaries_in_dir(const fs::path& path)
{
Files::check_is_directory(VCPKG_LINE_INFO, path);
check_is_directory(VCPKG_LINE_INFO, path);
Binaries binaries;
binaries.dlls = Files::recursive_find_files_with_extension_in_dir(path, ".dll");
@ -35,9 +41,9 @@ namespace vcpkg::Commands::Import
static void place_library_files_in(const fs::path& include_directory, const fs::path& project_directory, const fs::path& destination_path)
{
Files::check_is_directory(VCPKG_LINE_INFO, include_directory);
Files::check_is_directory(VCPKG_LINE_INFO, project_directory);
Files::check_is_directory(VCPKG_LINE_INFO, destination_path);
check_is_directory(VCPKG_LINE_INFO, include_directory);
check_is_directory(VCPKG_LINE_INFO, project_directory);
check_is_directory(VCPKG_LINE_INFO, destination_path);
Binaries debug_binaries = find_binaries_in_dir(project_directory / "Debug");
Binaries release_binaries = find_binaries_in_dir(project_directory / "Release");

View File

@ -6,11 +6,6 @@ namespace vcpkg::Files
{
static const std::regex FILESYSTEM_INVALID_CHARACTERS_REGEX = std::regex(R"([\/:*?"<>|])");
void check_is_directory(const LineInfo& line_info, const fs::path& dirpath)
{
Checks::check_exit(line_info, 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);