aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/src
diff options
context:
space:
mode:
Diffstat (limited to 'toolsrc/src')
-rw-r--r--toolsrc/src/VcpkgPaths.cpp14
-rw-r--r--toolsrc/src/vcpkg_System.cpp12
2 files changed, 14 insertions, 12 deletions
diff --git a/toolsrc/src/VcpkgPaths.cpp b/toolsrc/src/VcpkgPaths.cpp
index e2004c67b..64c4ae630 100644
--- a/toolsrc/src/VcpkgPaths.cpp
+++ b/toolsrc/src/VcpkgPaths.cpp
@@ -10,16 +10,6 @@
namespace vcpkg
{
- static std::string WORKAROUND_ISSUE_1712(const std::string& line)
- {
- auto colon_pos = line.find(':');
- if (colon_pos != std::string::npos && colon_pos > 1)
- {
- return line.substr(colon_pos - 1);
- }
- return line;
- }
-
static bool exists_and_has_equal_or_greater_version(const std::wstring& version_cmd,
const std::array<int, 3>& expected_version)
{
@@ -93,7 +83,7 @@ namespace vcpkg
Checks::exit_with_code(VCPKG_LINE_INFO, rc.exit_code);
}
- const fs::path actual_downloaded_path = WORKAROUND_ISSUE_1712(Strings::trimmed(rc.output));
+ const fs::path actual_downloaded_path = Strings::trimmed(rc.output);
std::error_code ec;
auto eq = fs::stdfs::equivalent(expected_downloaded_path, actual_downloaded_path, ec);
Checks::check_exit(VCPKG_LINE_INFO,
@@ -262,7 +252,7 @@ namespace vcpkg
const std::wstring cmd = System::create_powershell_script_cmd(script);
System::ExitCodeAndOutput ec_data = System::cmd_execute_and_capture_output(cmd);
Checks::check_exit(VCPKG_LINE_INFO, ec_data.exit_code == 0, "Could not run script to detect VS 2017 instances");
- return Util::fmap(Strings::split(ec_data.output, "\n"), WORKAROUND_ISSUE_1712);
+ return Strings::split(ec_data.output, "\n");
}
static Optional<fs::path> get_VS2015_installation_instance()
diff --git a/toolsrc/src/vcpkg_System.cpp b/toolsrc/src/vcpkg_System.cpp
index beaa997b8..40e335117 100644
--- a/toolsrc/src/vcpkg_System.cpp
+++ b/toolsrc/src/vcpkg_System.cpp
@@ -176,6 +176,17 @@ namespace vcpkg::System
return exit_code;
}
+ // On Win7, output from powershell calls contain a byte order mark, so we strip it out if it is present
+ static void remove_byte_order_mark(std::wstring* s)
+ {
+ const wchar_t* a = s->c_str();
+ // This is the UTF-8 byte-order mark
+ if (a[0] == 0xEF && a[1] == 0xBB && a[2] == 0xBF)
+ {
+ s->erase(0, 3);
+ }
+ }
+
ExitCodeAndOutput cmd_execute_and_capture_output(const CWStringView cmd_line)
{
// Flush stdout before launching external process
@@ -202,6 +213,7 @@ namespace vcpkg::System
const auto ec = _pclose(pipe);
Debug::println("_pclose() returned %d", ec);
+ remove_byte_order_mark(&output);
return {ec, Strings::to_utf8(output)};
}