find_config.cc
Go to the documentation of this file.
1 // ======================================================================
2 //
3 // find_config
4 //
5 // ======================================================================
6 
8 
9 #include "cetlib/search_path.h"
10 #include "cetlib_except/exception.h"
11 
12 bool
14  std::string const& search_path_spec,
15  std::string& full_path)
16 {
17  try {
18  cet::search_path sp(search_path_spec);
19  if (!sp.find_file(filename, full_path)) {
20  return false;
21  }
22  }
23  catch (cet::exception const& e) {
24  if (e.root_cause() == "getenv") {
25  // Assume file is findable as specified.
26  full_path = filename;
27  } else {
28  throw;
29  }
30  }
31  return true;
32 }
std::string string
Definition: nybbler.cc:12
string filename
Definition: train.py:213
const double e
bool find_config(std::string const &filename, std::string const &search_path_spec, std::string &full_path)
Definition: find_config.cc:13
std::string find_file(std::string const &filename) const
Definition: search_path.cc:96
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33