diff options
| author | Robert Schumacher <roschuma@microsoft.com> | 2016-09-30 14:59:58 -0700 |
|---|---|---|
| committer | Robert Schumacher <roschuma@microsoft.com> | 2016-09-30 14:59:58 -0700 |
| commit | 17786b865a9f004df391be69e8ad687d095f739b (patch) | |
| tree | 6c2047da6ac4a4a50775cc7ae7f92218cadd07d1 /toolsrc/src/triplet.cpp | |
| parent | 4ab32c520daa821250c6b4669dda7ce91b71d5e7 (diff) | |
| parent | 8ed88af8c9cf2ed2e6fd573b2cd5dc2b41b55625 (diff) | |
| download | vcpkg-17786b865a9f004df391be69e8ad687d095f739b.tar.gz vcpkg-17786b865a9f004df391be69e8ad687d095f739b.zip | |
Merge branch 'master' of https://github.com/microsoft/vcpkg
Diffstat (limited to 'toolsrc/src/triplet.cpp')
| -rw-r--r-- | toolsrc/src/triplet.cpp | 37 |
1 files changed, 6 insertions, 31 deletions
diff --git a/toolsrc/src/triplet.cpp b/toolsrc/src/triplet.cpp index 4270c458d..e3a935958 100644 --- a/toolsrc/src/triplet.cpp +++ b/toolsrc/src/triplet.cpp @@ -1,6 +1,4 @@ #include "triplet.h" -#include "vcpkg.h" -#include "vcpkg_System.h" #include "vcpkg_Checks.h" namespace vcpkg @@ -38,38 +36,15 @@ 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); - } - - bool triplet::validate(const vcpkg_paths& paths) const - { - auto it = fs::directory_iterator(paths.triplets); - for (; it != fs::directory_iterator(); ++it) - { - std::string triplet_file_name = it->path().stem().generic_u8string(); - if (value == triplet_file_name) // TODO: fuzzy compare - { - //value = triplet_file_name; // NOTE: uncomment when implementing fuzzy compare - return true; - } - } - return false; + 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()); } } |
