diff options
| author | Robert Schumacher <roschuma@microsoft.com> | 2017-08-29 19:04:47 -0700 |
|---|---|---|
| committer | Robert Schumacher <roschuma@microsoft.com> | 2017-08-29 19:04:47 -0700 |
| commit | 765068fa70259be5487db2ffc4ea3e6b6e4d73bd (patch) | |
| tree | 95934162cfebe95d44b56f008d1dfbf0efe63add /toolsrc | |
| parent | e0a9cae9283b78f4470479d0001ea058cc655789 (diff) | |
| download | vcpkg-765068fa70259be5487db2ffc4ea3e6b6e4d73bd.tar.gz vcpkg-765068fa70259be5487db2ffc4ea3e6b6e4d73bd.zip | |
[vcpkg] Refactor workaround for issue #1712. This should be removed once the root cause is found.
Diffstat (limited to 'toolsrc')
| -rw-r--r-- | toolsrc/src/VcpkgPaths.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/toolsrc/src/VcpkgPaths.cpp b/toolsrc/src/VcpkgPaths.cpp index 1fe92014c..ef9209b78 100644 --- a/toolsrc/src/VcpkgPaths.cpp +++ b/toolsrc/src/VcpkgPaths.cpp @@ -10,6 +10,16 @@ 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 > 0) + { + 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) { @@ -95,7 +105,7 @@ namespace vcpkg Checks::exit_with_code(VCPKG_LINE_INFO, rc.exit_code); } - const fs::path actual_downloaded_path = Strings::trimmed(rc.output); + const fs::path actual_downloaded_path = WORKAROUND_ISSUE_1712(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, @@ -264,14 +274,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"), [](const std::string& line) { - auto colon_pos = line.find(':'); - if (colon_pos != std::string::npos && colon_pos > 0) - { - return line.substr(colon_pos - 1); - } - return line; - }); + return Util::fmap(Strings::split(ec_data.output, "\n"), WORKAROUND_ISSUE_1712); } static Optional<fs::path> get_VS2015_installation_instance() |
