search for files in a list of directories
More...
#include <DirSearchPath.h>
|
| typedef boost::filesystem::path | path |
| |
|
|
| | DirSearchPath () |
| |
| | DirSearchPath (const std::string &stringifiedPath, const char *separator=",:") |
| |
|
| bool | add (const path &dir) |
| |
| bool | addCWD () |
| | add current work dir (*nix pwd) to path
|
| |
|
| bool | find (const std::string &fileName, std::string &fullFileName) const |
| | returns a flag if fileName found in search path, and sets ref to fully qualified file name (in native form)
|
| |
| bool | find (const path &file, path &fileFound) const |
| | returns a flag if file found in search path. Sets ref to completed path
|
| |
| std::list< path > | find_all (const path &file) const |
| | returns lists of files found in search path.
|
| |
|
|
| static bool | existsDir (const std::string &dirName) |
| | check dirName is valid
|
| |
| static bool | existsDir (const path &dir) |
| | check dir path is valid
|
| |
search for files in a list of directories
- Author
- Paolo Calafiura pcala.nosp@m.fiur.nosp@m.a@lbl.nosp@m..gov - ATLAS Collaboration
- Id:
- DirSearchPath.h,v 1.2 2007/10/16 15:37:25 marcocle Exp
Definition at line 19 of file DirSearchPath.h.
| DirSearchPath::DirSearchPath |
( |
| ) |
|
|
inline |
| DirSearchPath::DirSearchPath |
( |
const std::string & |
stringifiedPath, |
|
|
const char * |
separator = ",:" |
|
) |
| |
- Exceptions
-
| boost::filesystem::filesystem_error | |
Definition at line 29 of file DirSearchPath.cpp.
{
typedef tokenizer<char_separator<char> >
Tokenizer;
Tokenizer tok(stringifiedPath, char_separator<char>(separator));
Tokenizer::iterator it = tok.begin();
while(it != tok.end()) {
try {
}
catch (boost::filesystem::filesystem_error &) {
}
}
}
| bool DirSearchPath::add |
( |
const path & |
dir | ) |
|
| bool DirSearchPath::addCWD |
( |
| ) |
|
add current work dir (*nix pwd) to path
Definition at line 50 of file DirSearchPath.cpp.
{
return add(boost::filesystem::current_path());
}
| bool DirSearchPath::existsDir |
( |
const std::string & |
dirName | ) |
|
|
static |
check dirName is valid
Definition at line 102 of file DirSearchPath.cpp.
{
try {
rc=is_directory(
path(dirName));
} catch(...) {}
}
| bool DirSearchPath::existsDir |
( |
const path & |
dir | ) |
|
|
static |
check dir path is valid
Definition at line 109 of file DirSearchPath.cpp.
{
return (exists(dir) && is_directory(dir));
}
| bool DirSearchPath::find |
( |
const std::string & |
fileName, |
|
|
std::string & |
fullFileName |
|
) |
| const |
returns a flag if fileName found in search path, and sets ref to fully qualified file name (in native form)
Definition at line 64 of file DirSearchPath.cpp.
{
try {
fullFileName = fileFound.string();
} catch (...) {}
}
| bool DirSearchPath::find |
( |
const path & |
file, |
|
|
path & |
fileFound |
|
) |
| const |
returns a flag if file found in search path. Sets ref to completed path
Definition at line 75 of file DirSearchPath.cpp.
{
for (std::list<path>::const_iterator iDir=
m_dirs.begin(); iDir!=
m_dirs.end(); ++iDir) {
if (exists(full)) {
fileFound = full;
break;
}
}
}
returns lists of files found in search path.
Definition at line 90 of file DirSearchPath.cpp.
{
std::list<path> found;
for (std::list<path>::const_iterator iDir=
m_dirs.begin(); iDir!=
m_dirs.end(); ++iDir) {
if (exists(full)) {
found.push_back(full);
}
}
return found;
}
| std::list<path> DirSearchPath::m_dirs |
|
private |
The documentation for this class was generated from the following files:
- /afs/.cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v25r2/GaudiKernel/GaudiKernel/DirSearchPath.h
- /afs/.cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v25r2/GaudiKernel/src/Lib/DirSearchPath.cpp