aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Karatarakis <alkarata@microsoft.com>2018-03-30 18:44:13 -0700
committerAlexander Karatarakis <alkarata@microsoft.com>2018-03-30 18:44:22 -0700
commit4a9feaa2403e59b3267f8bd02ef2fd687ea5661d (patch)
treef828e542244df819dddbc0b8879216d1b54ae594
parent800f8b0e1dca9cfdb90a9e74c01060bc0440d2a6 (diff)
downloadvcpkg-4a9feaa2403e59b3267f8bd02ef2fd687ea5661d.tar.gz
vcpkg-4a9feaa2403e59b3267f8bd02ef2fd687ea5661d.zip
Allow usage of os="windows" in vcpkgTools.xml from vcpkg.exe
(use-cases in powershell still need to be modified)
-rw-r--r--toolsrc/src/vcpkg/vcpkgpaths.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/toolsrc/src/vcpkg/vcpkgpaths.cpp b/toolsrc/src/vcpkg/vcpkgpaths.cpp
index a17ffeb05..7ab4c1c98 100644
--- a/toolsrc/src/vcpkg/vcpkgpaths.cpp
+++ b/toolsrc/src/vcpkg/vcpkgpaths.cpp
@@ -44,11 +44,11 @@ namespace vcpkg
static ToolData parse_tool_data_from_xml(const VcpkgPaths& paths, const std::string& tool)
{
#if defined(_WIN32)
- static constexpr StringLiteral OS_STRING = "";
+ static constexpr StringLiteral OS_STRING = "windows";
#elif defined(__APPLE__)
- static constexpr StringLiteral OS_STRING = R"(os="osx")";
+ static constexpr StringLiteral OS_STRING = "osx";
#else // assume linux
- static constexpr StringLiteral OS_STRING = R"(os="linux")";
+ static constexpr StringLiteral OS_STRING = "linux";
#endif
static const fs::path XML_PATH = paths.scripts / "vcpkgTools.xml";
@@ -79,11 +79,16 @@ namespace vcpkg
Strings::format(R"###(<archiveRelativePath>([\s\S]*?)</archiveRelativePath>)###")};
static const std::regex URL_REGEX{Strings::format(R"###(<url>([\s\S]*?)</url>)###")};
- const std::regex tool_regex{
- Strings::format(R"###(<tool[\s]+name="%s"[\s]*%s>([\s\S]*?)</tool>)###", tool, OS_STRING)};
+ std::regex tool_regex{
+ Strings::format(R"###(<tool[\s]+name="%s"[\s]+os="%s">([\s\S]*?)<\/tool>)###", tool, OS_STRING)};
std::smatch match_tool;
- const bool has_match_tool = std::regex_search(XML.cbegin(), XML.cend(), match_tool, tool_regex);
+ bool has_match_tool = std::regex_search(XML.cbegin(), XML.cend(), match_tool, tool_regex);
+ if (!has_match_tool && OS_STRING == "windows") // Legacy support. Change introduced in vcpkg v0.0.107.
+ {
+ tool_regex = Strings::format(R"###(<tool[\s]+name="%s">([\s\S]*?)<\/tool>)###", tool);
+ has_match_tool = std::regex_search(XML.cbegin(), XML.cend(), match_tool, tool_regex);
+ }
Checks::check_exit(VCPKG_LINE_INFO,
has_match_tool,
"Could not find entry for tool [%s] in %s",