3 #include "artdaq-core/Utilities/SimpleLookupPolicy.hh"
4 #include "cetlib/filesystem.h"
17 cwdPath_ = std::make_unique<cet::search_path>(
".:.");
22 fallbackPaths_ = std::make_unique<cet::search_path>(
".:.");
28 auto workString(paths);
29 if (workString.find(
':') == std::string::npos)
31 workString.append(
":");
32 workString.append(paths);
34 fallbackPaths_ = std::make_unique<cet::search_path>(workString);
39 fallbackPaths_ = std::make_unique<cet::search_path>(paths);
45 if (cet::is_absolute_filepath(filename))
52 return cwdPath_->find_file(filename);
57 return fallbackPaths_->find_file(filename);
SimpleLookupPolicy(std::string const &paths, ArgType argType=ArgType::ENV_VAR)
Constructor.
Constructor argument is a list of directories.
virtual ~SimpleLookupPolicy() noexcept
Default destructor.
ArgType
Flag if the constructor argument is a list of paths or the name of an environment variable...
std::string operator()(std::string const &filename) override
Perform the file lookup.