aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/src/triplet.cpp
diff options
context:
space:
mode:
authorAlbert Ziegenhagel <albert.ziegenhagel@outlook.com>2016-09-23 09:44:30 +0200
committerAlbert Ziegenhagel <albert.ziegenhagel@outlook.com>2016-09-23 09:44:30 +0200
commit31935aa0fd142cbb4e0db1a62ba1483294b740f8 (patch)
tree41be4e9498a385ecc8796d9158bf871c07ecdbc1 /toolsrc/src/triplet.cpp
parent4a818b6a3e86514af27381fe16dcf311a5c28ffb (diff)
downloadvcpkg-31935aa0fd142cbb4e0db1a62ba1483294b740f8.tar.gz
vcpkg-31935aa0fd142cbb4e0db1a62ba1483294b740f8.zip
Improved error reporting when user provides invalid triplets
Diffstat (limited to 'toolsrc/src/triplet.cpp')
-rw-r--r--toolsrc/src/triplet.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/toolsrc/src/triplet.cpp b/toolsrc/src/triplet.cpp
index 9ad3d8847..14f19d5cd 100644
--- a/toolsrc/src/triplet.cpp
+++ b/toolsrc/src/triplet.cpp
@@ -1,4 +1,5 @@
#include "triplet.h"
+#include "vcpkg.h"
#include "vcpkg_System.h"
#include "vcpkg_Checks.h"
@@ -56,4 +57,19 @@ namespace vcpkg
Checks::exit_with_message("Unknown system: %s", value);
}
+
+ bool triplet::validate(const vcpkg_paths & paths)
+ {
+ 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;
+ }
}