Newer
Older
}
return m_proxyInfo;
}
std::string ConfigServiceImpl::getFullPath(const std::string &filename,
const bool ignoreDirs,
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 &) {
}
for (const auto &searchPath :
Kernel::ConfigService::Instance().getDataSearchDirs()) {
g_log.debug() << "Searching for " << fName << " in " << searchPath << "\n";
// On windows globbing is not working properly with network drives
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
2052
2053
2054
2055
// 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 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