diff options
Diffstat (limited to 'toolsrc/src')
| -rw-r--r-- | toolsrc/src/vcpkg/install.cpp | 61 |
1 files changed, 29 insertions, 32 deletions
diff --git a/toolsrc/src/vcpkg/install.cpp b/toolsrc/src/vcpkg/install.cpp index 595945d39..631b16c59 100644 --- a/toolsrc/src/vcpkg/install.cpp +++ b/toolsrc/src/vcpkg/install.cpp @@ -69,7 +69,7 @@ namespace vcpkg::Install continue; } - const std::string filename = file.filename().generic_string(); + const std::string filename = file.filename().u8string(); if (fs::is_regular_file(status) && (Strings::case_insensitive_ascii_equals(filename.c_str(), "CONTROL") || Strings::case_insensitive_ascii_equals(filename.c_str(), "BUILD_INFO"))) { @@ -80,44 +80,41 @@ namespace vcpkg::Install const std::string suffix = file.generic_u8string().substr(prefix_length + 1); const fs::path target = destination / suffix; - if (fs::is_directory(status)) + switch (status.type()) { - fs.create_directory(target, ec); - if (ec) + case fs::file_type::directory: { - System::println(System::Color::error, "failed: %s: %s", target.u8string(), ec.message()); - } - - // Trailing backslash for directories - output.push_back(Strings::format(R"(%s/%s/)", destination_subdirectory, suffix)); - continue; - } + fs.create_directory(target, ec); + if (ec) + { + System::println(System::Color::error, "failed: %s: %s", target.u8string(), ec.message()); + } - if (fs::is_regular_file(status)) - { - if (fs.exists(target)) - { - System::println(System::Color::warning, - "File %s was already present and will be overwritten", - target.u8string(), - ec.message()); + // Trailing backslash for directories + output.push_back(Strings::format(R"(%s/%s/)", destination_subdirectory, suffix)); + break; } - fs.copy_file(file, target, fs::copy_options::overwrite_existing, ec); - if (ec) + case fs::file_type::regular: { - System::println(System::Color::error, "failed: %s: %s", target.u8string(), ec.message()); + if (fs.exists(target)) + { + System::println(System::Color::warning, + "File %s was already present and will be overwritten", + target.u8string(), + ec.message()); + } + fs.copy_file(file, target, fs::copy_options::overwrite_existing, ec); + if (ec) + { + System::println(System::Color::error, "failed: %s: %s", target.u8string(), ec.message()); + } + output.push_back(Strings::format(R"(%s/%s)", destination_subdirectory, suffix)); + break; } - output.push_back(Strings::format(R"(%s/%s)", destination_subdirectory, suffix)); - continue; - } - - if (!fs::status_known(status)) - { - System::println(System::Color::error, "failed: %s: unknown status", file.u8string()); - continue; + default: + System::println(System::Color::error, "failed: %s: cannot handle file type", file.u8string()); + break; } - - System::println(System::Color::error, "failed: %s: cannot handle file type", file.u8string()); } std::sort(output.begin(), output.end()); |
