| The Gaudi Framework v27r1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Types | Static Public Member Functions | List of all members
System::PathResolver Class Reference

`#include <GaudiKernel/PathResolver.h>`

## Public Types
enum | SearchPathStatus { Ok, EnvironmentVariableUndefined, UnknownDirectory }
enum | SearchType { LocalSearch, RecursiveSearch }

## Static Public Member Functions
static std::string | find_file (const std::string &logical_file_name, const std::string &search_path, SearchType search_type=LocalSearch)
static std::string | find_file_from_list (const std::string &logical_file_name, const std::string &search_list, SearchType search_type=LocalSearch)
static std::string | find_directory (const std::string &logical_file_name, const std::string &search_path, SearchType search_type=LocalSearch)
static std::string | find_directory_from_list (const std::string &logical_file_name, const std::string &search_list, SearchType search_type=LocalSearch)
static SearchPathStatus | check_search_path (const std::string &search_path)

## Detailed Description

Definition at line 10 of file PathResolver.h.

## Member Enumeration Documentation

enum System::PathResolver::SearchPathStatus

Enumerator
Ok |
EnvironmentVariableUndefined |
UnknownDirectory |

Definition at line 14 of file PathResolver.h.

15 {
16 Ok,
17 EnvironmentVariableUndefined,
18 UnknownDirectory
19 } SearchPathStatus;
System::PathResolver::Ok
Definition: PathResolver.h:16
System::PathResolver::SearchPathStatus
SearchPathStatus
Definition: PathResolver.h:14
System::PathResolver::EnvironmentVariableUndefined
Definition: PathResolver.h:17
System::PathResolver::UnknownDirectory
Definition: PathResolver.h:18

enum System::PathResolver::SearchType

Enumerator
LocalSearch |
RecursiveSearch |

Definition at line 21 of file PathResolver.h.

22 {
23 LocalSearch,
24 RecursiveSearch
25 } SearchType;
System::PathResolver::LocalSearch
Definition: PathResolver.h:23
System::PathResolver::RecursiveSearch
Definition: PathResolver.h:24
System::PathResolver::SearchType
SearchType
Definition: PathResolver.h:21

## Member Function Documentation

PathResolver::SearchPathStatus System::PathResolver::check_search_path | ( | const std::string & | search_path | ) |
| static

- `search_path` the name of a path-like environment variable

Returns
  the result of the verification. Can be one of `Ok`, `EnvironmentVariableUndefined`, `UnknownDirectory`

Definition at line 196 of file PathResolver.cpp.

197 {
198 std::string path_list;
199 if ( ! System::getEnv(search_path, path_list) )
200 return (EnvironmentVariableUndefined);
201
202 vector<string> spv;
203 boost::split( spv, path_list, boost::is_any_of( path_separator ), boost::token_compress_on);
204
205 try {
206 for (const auto& itr : spv ) {
207 bf::path pp(itr);
208 if (!is_directory(pp)) {
209 return (UnknownDirectory);
210 }
211 }
212 } catch(bf::filesystem_error /*err*/) {
213 return (UnknownDirectory);
214 }
215
216 return ( Ok );
217 }
System::getEnv
GAUDI_API std::string getEnv(const char *var)
get a particular environment variable (returning "UNKNOWN" if not set)
Definition: System.cpp:617
System::PathResolver::Ok
Definition: PathResolver.h:16
std::string
STL class.
System::PathResolver::EnvironmentVariableUndefined
Definition: PathResolver.h:17
Gaudi::Utils::Histos::path
GAUDI_API std::string path(const AIDA::IBaseHistogram *aida)
get the path in THS for AIDA histogram
Definition: HistoTableFormat.cpp:191
std::vector
STL class.
compareOutputFiles.pp
tuple pp
Definition: compareOutputFiles.py:417
System::PathResolver::UnknownDirectory
Definition: PathResolver.h:18

string System::PathResolver::find_directory | ( | const std::string & | logical_file_name,
|  | const std::string & | search_path,
|  | SearchType | search_type = `LocalSearch`
| ) |  |
| static

- `logical_file_name` the name of the directory to locate in the search path
- `search_path` the name of a path-like environment variable
- `search_type` characterizes the type of search. Can be either LocalSearch or RecursiveSearch

Returns
  the physical name of the located directory or empty string if not found

Definition at line 165 of file PathResolver.cpp.

168 {
169 std::string path_list;
170 System::getEnv(search_path, path_list);
171
172 return (find_directory_from_list (logical_file_name, path_list, search_type));
173 }
System::getEnv
GAUDI_API std::string getEnv(const char *var)
get a particular environment variable (returning "UNKNOWN" if not set)
Definition: System.cpp:617
std::string
STL class.
System::PathResolver::find_directory_from_list
static std::string find_directory_from_list(const std::string &logical_file_name, const std::string &search_list, SearchType search_type=LocalSearch)
Definition: PathResolver.cpp:178

string System::PathResolver::find_directory_from_list | ( | const std::string & | logical_file_name,
|  | const std::string & | search_list,
|  | SearchType | search_type = `LocalSearch`
| ) |  |
| static

- `logical_file_name` the name of the directory to locate in the search path
- `search_list` the prioritized list of possible locations separated by the usual path separator
- `search_type` characterizes the type of search. Can be either LocalSearch or RecursiveSearch

Returns
  the physical name of the located directory or empty string if not found

Definition at line 178 of file PathResolver.cpp.

181 {
182 std::string result;
183
184 if (!PR_find (logical_file_name, search_list, PR_directory, search_type, result))
185 {
186 result = "";
187 }
188
189 return (result);
190 }
System::PR_directory
Definition: PathResolver.cpp:37
std::string
STL class.

string System::PathResolver::find_file | ( | const std::string & | logical_file_name,
|  | const std::string & | search_path,
|  | SearchType | search_type = `LocalSearch`
| ) |  |
| static

- `logical_file_name` the name of the file to locate in the search path
- `search_path` the name of a path-like environment variable
- `search_type` characterizes the type of search. Can be either `LocalSearch` or `RecursiveSearch`

Returns
  the physical name of the located file or empty string if not found

Definition at line 126 of file PathResolver.cpp.

128 {
129
130 std::string path_list;
131 System::getEnv(search_path, path_list);
132
133 return (find_file_from_list (logical_file_name, path_list, search_type));
134 }
System::getEnv
GAUDI_API std::string getEnv(const char *var)
get a particular environment variable (returning "UNKNOWN" if not set)
Definition: System.cpp:617
System::PathResolver::find_file_from_list
static std::string find_file_from_list(const std::string &logical_file_name, const std::string &search_list, SearchType search_type=LocalSearch)
Definition: PathResolver.cpp:139
std::string
STL class.

std::string System::PathResolver::find_file_from_list | ( | const std::string & | logical_file_name,
|  | const std::string & | search_list,
|  | SearchType | search_type = `LocalSearch`
| ) |  |
| static

- `logical_file_name` the name of the file to locate in the search path
- `search_list` the prioritized list of possible locations separated by the usual path separator
- `search_type` characterizes the type of search. Can be either `LocalSearch` or `RecursiveSearch`

Returns
  the physical name of the located file or empty string if not found

Definition at line 139 of file PathResolver.cpp.

142 {
143 std::string result("");
144
145 bf::path lfn( logical_file_name );
146
147 /* bool found = */
148 PR_find (lfn, search_list, PR_regular_file, search_type, result);
149
150 // The following functionality was in the original PathResolver, but I believe
151 // that it's WRONG. It extracts the filename of the requested item, and searches
152 // for that if the preceding search fails. i.e., if you're looking for "B/a.txt",
153 // and that fails, it will look for just "a.txt" in the search list.
154
155 // if (! found && lfn.filename() != lfn ) {
156 // result = "";
157 // PR_find (lfn.filename(), search_list, PR_regular_file, search_type, result);
158 // }
159
160 return (result);
161 }
std::string
STL class.
System::PR_regular_file
Definition: PathResolver.cpp:36
Gaudi::Utils::Histos::path
GAUDI_API std::string path(const AIDA::IBaseHistogram *aida)
get the path in THS for AIDA histogram
Definition: HistoTableFormat.cpp:191

The documentation for this class was generated from the following files:

- GaudiKernel/GaudiKernel/PathResolver.h
- GaudiKernel/src/Lib/PathResolver.cpp