Elements  5.12
A C++ base framework for the Euclid Software.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Auxiliary.icpp
Go to the documentation of this file.
1 
21 #ifdef ELEMENTSKERNEL_ELEMENTSKERNEL_AUXILIARY_IMPL_
22 
23 #include "ElementsKernel/System.h" // for DEFAULT_INSTALL_PREFIX
24 #include "ElementsKernel/Exception.h" // for Exception
25 #include "ElementsKernel/Path.h" // for Path::VARIABLE, Path::Type, Path::Item
26  // getPathFromLocations
27 namespace Elements {
28 
29 template <typename T>
30 Path::Item getAuxiliaryPath(const T& file_name, bool raise_exception) {
31 
32  auto location_list = getAuxiliaryLocations();
33 
34  auto result = Path::getPathFromLocations(file_name, location_list);
35 
36  if (result.empty() and raise_exception) {
37  throw Exception() << "The auxiliary path \"" << file_name << "\" cannot be found!";
38  }
39 
40  return result;
41 }
42 
43 } // namespace Elements
44 
45 #endif // ELEMENTSKERNEL_ELEMENTSKERNEL_AUXILIARY_IMPL_
ELEMENTS_API Path::Item getAuxiliaryPath(const T &file_name, bool raise_exception=true)
ELEMENTS_API Item getPathFromLocations(const T &file_name, const std::vector< U > &locations)
retrieve path from a file name and a set of location to look into
This file is intended to iron out all the differences between systems (currently Linux and MacOSX) ...
ELEMENTS_API std::vector< Path::Item > getAuxiliaryLocations(bool exist_only=false)
Definition: Auxiliary.cpp:48
boost::filesystem::path Item
Definition: Path.h:61
provide functions to retrieve resources pointed by environment variables
defines the base Elements exception class