Move components from proving-ground
Move all needed components from proving ground to this
repo. Some clean up was done in json files to fix probes
as well as some slight modification to readme.
Change-Id: I05b7f6459704640c4850420a4573d157500d0aff
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/src/Utils.cpp b/src/Utils.cpp
new file mode 100644
index 0000000..e63861e
--- /dev/null
+++ b/src/Utils.cpp
@@ -0,0 +1,49 @@
+/*
+// Copyright (c) 2017 Intel Corporation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+*/
+
+#include <Utils.hpp>
+#include <experimental/filesystem>
+#include <fstream>
+#include <regex>
+
+namespace fs = std::experimental::filesystem;
+
+bool find_files(const fs::path &dir_path, const std::string &match_string,
+ std::vector<fs::path> &found_paths, unsigned int symlink_depth)
+{
+ if (!fs::exists(dir_path))
+ return false;
+
+ fs::directory_iterator end_itr;
+ std::regex search(match_string);
+ std::smatch match;
+ for (auto &p : fs::recursive_directory_iterator(dir_path))
+ {
+ std::string path = p.path().string();
+ if (!is_directory(p))
+ {
+ if (std::regex_search(path, match, search))
+ found_paths.emplace_back(p.path());
+ }
+ // since we're using a recursve iterator, these should only be symlink
+ // dirs
+ else if (symlink_depth)
+ {
+ find_files(p.path(), match_string, found_paths, symlink_depth - 1);
+ }
+ }
+ return true;
+}
\ No newline at end of file