LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
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
13 art::find_config(std::string const& filename,
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 }
bool find_config(std::string const &filename, std::string const &search_path_spec, std::string &full_path)
Definition: find_config.cc:13
Float_t e
Definition: plot.C:34
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33