Newer
Older
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
Poco::Glob::Options options) const {
std::string fName = Kernel::Strings::strip(filename);
g_log.debug() << "getFullPath(" << fName << ")\n";
// If this is already a full path, nothing to do
if (Poco::Path(fName).isAbsolute())
return fName;
// First try the path relative to the current directory. Can throw in some
// circumstances with extensions that have wild cards
try {
Poco::File fullPath(Poco::Path().resolve(fName));
if (fullPath.exists() && (!ignoreDirs || !fullPath.isDirectory()))
return fullPath.path();
} catch (std::exception &) {
}
const std::vector<std::string> &searchPaths =
Kernel::ConfigService::Instance().getDataSearchDirs();
for (const auto &searchPath : searchPaths) {
g_log.debug() << "Searching for " << fName << " in " << searchPath << "\n";
// On windows globbing is note working properly with network drives
// for example a network drive containing a $
// For this reason, and since windows is case insensitive anyway
// a special case is made for windows
#ifdef _WIN32
if (fName.find("*") != std::string::npos) {
#endif
Poco::Path path(searchPath, fName);
std::set<std::string> files;
Kernel::Glob::glob(path, files, options);
if (!files.empty()) {
Poco::File matchPath(*files.begin());
if (ignoreDirs && matchPath.isDirectory()) {
continue;
}
return *files.begin();
}
#ifdef _WIN32
} else {
Poco::Path path(searchPath, fName);
Poco::File file(path);
if (file.exists() && !(ignoreDirs && file.isDirectory())) {
return path.toString();
}
}
#endif
}
return "";
}
/** Sets the log level priority for the File log channel
/** Sets the log level priority for all logging channels
* @param logLevel the integer value of the log level to set, 1=Critical,
* 7=Debug
* @param quiet If true then no message regarding the level change is emitted
*/
void ConfigServiceImpl::setLogLevel(int logLevel, bool quiet) {
Mantid::Kernel::Logger::setLevelForAll(logLevel);
if (!quiet) {
g_log.log("logging set to " + Logger::PriorityNames[logLevel] + " priority",
static_cast<Logger::Priority>(logLevel));
Campbell, Stuart
committed
/// \cond TEMPLATE
template DLLExport boost::optional<double>
ConfigServiceImpl::getValue(const std::string &);
template DLLExport boost::optional<std::string>
ConfigServiceImpl::getValue(const std::string &);
template DLLExport boost::optional<int>
ConfigServiceImpl::getValue(const std::string &);
template DLLExport boost::optional<size_t>
ConfigServiceImpl::getValue(const std::string &);
template DLLExport boost::optional<bool>
ConfigServiceImpl::getValue(const std::string &);
Campbell, Stuart
committed
/// \endcond TEMPLATE
} // namespace Kernel
} // namespace Mantid