24#ifndef ELEMENTSKERNEL_ELEMENTSKERNEL_PATHSEARCH_IMPL_
25#error "This file should not be included directly! Use ElementsKernel/PathSearch.h instead"
31#include <boost/filesystem.hpp>
39template <
typename T,
typename ITER>
40std::vector<T>
pathSearch(
const std::string& searched_name, T directory) {
43 std::vector<T> searchResults{};
48 if (boost::filesystem::is_directory(l_directory)) {
50 for (ITER dir_iter(l_directory); dir_iter != end_iter; ++dir_iter) {
51 if (dir_iter->path().filename() == searched_name) {
54 T l_result{dir_iter->path().string()};
63std::vector<T> searchOption(std::string searched_name, T directory,
SearchType search_type) {
66 std::vector<T> searchResults{};
67 switch (search_type) {
79std::vector<T>
pathSearch(
const std::string& searched_name, T directory,
SearchType search_type) {
80 return searchOption<T>(searched_name, directory, search_type);
provide functions to retrieve resources pointed by environment variables
T emplace_back(T... args)
ELEMENTS_API std::vector< T > pathSearch(const std::string &searched_name, T directory, SearchType search_type)
Searches for a file or a directory in a directory. The search can be recursive (SearchType....
boost::filesystem::path Item