aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/src/triplet.cpp
diff options
context:
space:
mode:
authorAlexander Karatarakis <alkarata@microsoft.com>2016-09-27 15:51:38 -0700
committerAlexander Karatarakis <alkarata@microsoft.com>2016-09-29 14:58:09 -0700
commit8ea76e833eff904a958348b560a57e12b3fbeb3f (patch)
tree05487d3d4ee20b31672e03ccc6234c0e0cf28b63 /toolsrc/src/triplet.cpp
parent6273b1d1702f4ec1a356c99dac9ae3862f5b73e7 (diff)
downloadvcpkg-8ea76e833eff904a958348b560a57e12b3fbeb3f.tar.gz
vcpkg-8ea76e833eff904a958348b560a57e12b3fbeb3f.zip
[triplet] Part before dash is arch. Part after dash is system
Diffstat (limited to 'toolsrc/src/triplet.cpp')
-rw-r--r--toolsrc/src/triplet.cpp24
1 files changed, 8 insertions, 16 deletions
diff --git a/toolsrc/src/triplet.cpp b/toolsrc/src/triplet.cpp
index 4270c458d..080198f2b 100644
--- a/toolsrc/src/triplet.cpp
+++ b/toolsrc/src/triplet.cpp
@@ -38,24 +38,16 @@ namespace vcpkg
std::string triplet::architecture() const
{
- if (*this == X86_WINDOWS || *this == X86_UWP)
- return "x86";
- if (*this == X64_WINDOWS || *this == X64_UWP)
- return "x64";
- if (*this == ARM_UWP)
- return "arm";
-
- Checks::exit_with_message("Unknown architecture: %s", value);
+ auto it = std::find(this->value.cbegin(), this->value.cend(), '-');
+ Checks::check_exit(it != this->value.end(), "Invalid triplet: %s", this->value);
+ return std::string(this->value.cbegin(), it);
}
std::string triplet::system() const
{
- if (*this == X86_WINDOWS || *this == X64_WINDOWS)
- return "windows";
- if (*this == X86_UWP || *this == X64_UWP || *this == ARM_UWP)
- return "uwp";
-
- Checks::exit_with_message("Unknown system: %s", value);
+ auto it = std::find(this->value.cbegin(), this->value.cend(), '-');
+ Checks::check_exit(it != this->value.end(), "Invalid triplet: %s", this->value);
+ return std::string(it + 1, this->value.cend());
}
bool triplet::validate(const vcpkg_paths& paths) const
@@ -64,9 +56,9 @@ namespace vcpkg
for (; it != fs::directory_iterator(); ++it)
{
std::string triplet_file_name = it->path().stem().generic_u8string();
- if (value == triplet_file_name) // TODO: fuzzy compare
+ if (this->value == triplet_file_name) // TODO: fuzzy compare
{
- //value = triplet_file_name; // NOTE: uncomment when implementing fuzzy compare
+ //this->value = triplet_file_name; // NOTE: uncomment when implementing fuzzy compare
return true;
}
}