9 #include "Helpers/XmlHelper.h" 21 std::string LArFileHelper::FindFileInPath(
const std::string &unqualifiedFileName,
const std::string &environmentVariable,
const std::string &delimiter)
23 StringVector filePaths;
24 const char *
const pFilePathList(std::getenv(environmentVariable.c_str()));
27 XmlHelper::TokenizeString(pFilePathList, filePaths, delimiter);
30 filePaths.push_back(
"");
32 for (
const std::string &filePath : filePaths)
34 const std::string qualifiedFileNameAttempt(filePath +
"/" + unqualifiedFileName);
37 if (0 == stat(qualifiedFileNameAttempt.c_str(), &fileInfo))
38 return qualifiedFileNameAttempt;
41 std::cout <<
"Unable to find file " << unqualifiedFileName <<
" in any path specified by environment variable " << environmentVariable
42 <<
", delimiter " << delimiter << std::endl;
43 throw StatusCodeException(STATUS_CODE_NOT_FOUND);
Header file for the file helper class.