Newer
Older
g_log.debug("Checking for ParaView");
bool isAvailable = false;
try {
// Try to run "paraview -V", which will succeed if ParaView is installed.
std::string paraviewDir = getString("paraview.path");
std::string cmd = "paraview";
Poco::Path paraviewExe = Poco::Path(paraviewDir, "paraview");
cmd = paraviewExe.toString();
}
std::vector<std::string> args;
args.push_back("-V");
Poco::ProcessHandle ph =
Poco::Process::launch(cmd, args, 0, &outPipe, &errorPipe);
// Only if the paraview query returned successfully.
// Check the actual version numbers against what we expect they should be.
const std::string givenVersionNumber =
extractVersionNumberFromPipe(errorPipe);
const std::string targetVersionNumber = ParaViewVersion::targetVersion();
if (givenVersionNumber == targetVersionNumber) {
g_log.information("ParaView is available");
// Now set the plugin path.
this->setParaViewPluginPath();
std::stringstream messageStream;
messageStream << "The compatible version of ParaView is "
<< targetVersionNumber << " but the installed version is "
<< givenVersionNumber;
g_log.debug(messageStream.str());
g_log.information("ParaView is not available");
std::stringstream messageStream;
messageStream << "ParaView version query failed with code: " << rc;
g_log.debug(messageStream.str());
g_log.information("ParaView is not available");
g_log.debug(e.what());
g_log.information("ParaView is not available");
/*
Quick check to determine if VATES is installed.
@return TRUE if available.
*/
bool ConfigServiceImpl::quickVatesCheck() const {
std::string path = this->getDirectoryOfExecutable();
Poco::File dir(path);
typedef std::vector<std::string> VecFiles;
VecFiles files;
dir.list(files);
VecFiles::iterator it = files.begin();
bool found = false;
boost::regex expression("^(VatesSimpleGui)", boost::regex::icase);
if (boost::regex_search(file, expression)) {
found = true;
break;
}
++it;
}
return found;
}
/*
Gets the system proxy information
@url A url to match the proxy to
@return the proxy information.
*/
Kernel::ProxyInfo &ConfigServiceImpl::getProxy(const std::string &url) {
if (!m_isProxySet) {
// set the proxy
// first check if the proxy is defined in the properties file
std::string proxyHost;
int proxyPort;
if ((getValue("proxy.host", proxyHost) == 1) &&
(getValue("proxy.port", proxyPort) == 1)) {
// set it from the config values
m_proxyInfo = ProxyInfo(proxyHost, proxyPort, true);
} else {
// get the system proxy
Poco::URI uri(url);
Mantid::Kernel::NetworkProxy proxyHelper;
m_proxyInfo = proxyHelper.getHttpProxy(uri.toString());
m_isProxySet = true;
}
return m_proxyInfo;
}
/**
* Gets the path to ParaView.
* @returns The ParaView path.
*/
const std::string ConfigServiceImpl::getParaViewPath() const {
return getString("paraview.path");
}
Campbell, Stuart
committed
/// \cond TEMPLATE
template DLLExport int ConfigServiceImpl::getValue(const std::string &,
double &);
template DLLExport int ConfigServiceImpl::getValue(const std::string &,
std::string &);
template DLLExport int ConfigServiceImpl::getValue(const std::string &, int &);
template DLLExport int ConfigServiceImpl::getValue(const std::string &,
std::size_t &);
Campbell, Stuart
committed
/// \endcond TEMPLATE
} // namespace Kernel
} // namespace Mantid