1c18e2b64SPatrick Venture /* 2c18e2b64SPatrick Venture * Copyright 2018 Google Inc. 3c18e2b64SPatrick Venture * 4c18e2b64SPatrick Venture * Licensed under the Apache License, Version 2.0 (the "License"); 5c18e2b64SPatrick Venture * you may not use this file except in compliance with the License. 6c18e2b64SPatrick Venture * You may obtain a copy of the License at 7c18e2b64SPatrick Venture * 8c18e2b64SPatrick Venture * http://www.apache.org/licenses/LICENSE-2.0 9c18e2b64SPatrick Venture * 10c18e2b64SPatrick Venture * Unless required by applicable law or agreed to in writing, software 11c18e2b64SPatrick Venture * distributed under the License is distributed on an "AS IS" BASIS, 12c18e2b64SPatrick Venture * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13c18e2b64SPatrick Venture * See the License for the specific language governing permissions and 14c18e2b64SPatrick Venture * limitations under the License. 15c18e2b64SPatrick Venture */ 16c18e2b64SPatrick Venture 17c18e2b64SPatrick Venture #include "fs.hpp" 18c18e2b64SPatrick Venture 19*48eb4029SPatrick Venture #include <filesystem> 20c18e2b64SPatrick Venture #include <string> 21c18e2b64SPatrick Venture #include <vector> 22c18e2b64SPatrick Venture 23c18e2b64SPatrick Venture namespace blobs 24c18e2b64SPatrick Venture { 25*48eb4029SPatrick Venture namespace fs = std::filesystem; 26c18e2b64SPatrick Venture getLibraryList(const std::string & path,PathMatcher check)27c18e2b64SPatrick Venturestd::vector<std::string> getLibraryList(const std::string& path, 28c18e2b64SPatrick Venture PathMatcher check) 29c18e2b64SPatrick Venture { 30c18e2b64SPatrick Venture std::vector<std::string> output; 31c18e2b64SPatrick Venture 32c18e2b64SPatrick Venture for (const auto& p : fs::recursive_directory_iterator(path)) 33c18e2b64SPatrick Venture { 34c18e2b64SPatrick Venture auto ps = p.path().string(); 35c18e2b64SPatrick Venture 36c18e2b64SPatrick Venture if (check(ps)) 37c18e2b64SPatrick Venture { 38c18e2b64SPatrick Venture output.push_back(ps); 39c18e2b64SPatrick Venture } 40c18e2b64SPatrick Venture } 41c18e2b64SPatrick Venture 42c18e2b64SPatrick Venture /* Algorithm ends up being two-pass, but expectation is a list under 10. */ 43c18e2b64SPatrick Venture return output; 44c18e2b64SPatrick Venture } 45c18e2b64SPatrick Venture 46c18e2b64SPatrick Venture } // namespace blobs 47