Skip to content
Snippets Groups Projects
ConfigService.cpp 66.1 KiB
Newer Older
will also be available on the library path, or equivalent.
@return True if paraview is available or not disabled.
*/
bool ConfigServiceImpl::quickParaViewCheck() const
{
  const std::string paraviewIgnoreProperty = "paraview.ignore";
  const bool ignoreParaview = hasProperty(paraviewIgnoreProperty) && atoi(getString(paraviewIgnoreProperty).c_str());
  if(ignoreParaview)
  {
    g_log.debug("Ignoring ParaView");
  g_log.debug("Checking for ParaView");
    //Try to run "paraview -V", which will succeed if ParaView is installed.
    std::string paraviewDir = getString("paraview.path");
    std::string cmd = "paraview";
    if(!paraviewDir.empty())
    {
      Poco::Path paraviewExe = Poco::Path(paraviewDir, "paraview");
      cmd = paraviewExe.toString();
    }
    std::vector<std::string> args;
    Poco::Pipe outPipe, errorPipe;
    Poco::ProcessHandle ph = Poco::Process::launch(cmd, args, 0, &outPipe, &errorPipe);
    const int rc = ph.wait();
    // 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)
      {
        isAvailable = true;
        g_log.information("ParaView is available");
        // Now set the plugin path.
        this->setParaViewPluginPath();
      }
      else
      {
        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");
  catch(Poco::SystemException &e)
    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;
  while(it != files.end())
  {
    std::string file = *it;
    boost::regex expression("^(VatesSimpleGui)", boost::regex::icase);
    if(boost::regex_search(file, expression))
/// \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&);
Peterson, Peter's avatar
Peterson, Peter committed
template DLLExport int ConfigServiceImpl::getValue(const std::string&, std::size_t&);

} // namespace Kernel
} // namespace Mantid