diff options
Diffstat (limited to 'toolsrc/src/triplet.cpp')
| -rw-r--r-- | toolsrc/src/triplet.cpp | 24 |
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; } } |
