Skip to content

Commit

Permalink
Fix setting PV_PLUGIN_PATH in ConfigService. Refs #5379
Browse files Browse the repository at this point in the history
The relative path was wrong for OS X. It now just uses the key in
the properties file. Also quietened the output of querying paraview
by capturing the stderr as well.
  • Loading branch information
martyngigg committed May 24, 2012
1 parent f2ceb68 commit 6bc1fa4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
1 change: 1 addition & 0 deletions Code/Mantid/Framework/Kernel/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ if ( ${CMAKE_PROJECT_NAME} STREQUAL "MantidFramework" )
endif ()

set ( PLUGINS "." )
set ( PV_PLUGINS "./pvplugins/pvplugins" )
set ( QTPLUGINS "." )
set ( PYTHONALGS ${MANTID_ROOT}/Framework/PythonAPI/PythonAlgorithms )
set ( DATADIRS ${MANTID_ROOT}/../../Test/AutoTestData;${MANTID_ROOT}/instrument )
Expand Down
27 changes: 20 additions & 7 deletions Code/Mantid/Framework/Kernel/src/ConfigService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -474,10 +474,15 @@ void ConfigServiceImpl::convertRelativeToAbsolute()
* Make a relative path or a list of relative paths into an absolute one.
* @param dir :: The directory to convert
* @param key :: The key variable this relates to
* @returns A string containing an aboluste path by resolving the relative directory with the executable directory
* @returns A string containing an absolute path by resolving the relative directory with the executable directory
*/
std::string ConfigServiceImpl::makeAbsolute(const std::string & dir, const std::string & key) const
{
if(dir.empty())
{
// Don't do anything for an empty value
return dir;
}
std::string converted;
// If we have a list, chop it up and convert each one
if (dir.find_first_of(";,") != std::string::npos)
Expand Down Expand Up @@ -1284,13 +1289,21 @@ bool ConfigServiceImpl::isNetworkDrive(const std::string & path)
void ConfigServiceImpl::setParaViewPluginPath() const
{
std::string mantid_loc = this->getDirectoryOfExecutable();
Poco::Path pv_plugin_path(mantid_loc + "/pvplugins/pvplugins");
Poco::Path pv_plugin_path(mantid_loc + "/pvplugins/pvplugins"); // Developer build paths
pv_plugin_path = pv_plugin_path.absolute();
g_log.debug() << "Trying " << pv_plugin_path.toString() << " as PV_PLUGIN_PATH\n";
Poco::File pv_plugin(pv_plugin_path.toString());
if (!pv_plugin.exists() || !pv_plugin.isDirectory())
{
g_log.debug("ParaView plugin directory \"" + pv_plugin.path() + "\" does not exist");
pv_plugin_path = Poco::Path(mantid_loc + "/../pvplugins/pvplugins");
// Installation paths
g_log.debug("ParaView plugin directory \"" + pv_plugin.path() + "\" does not exist. Trying properties file location.");
std::string user_loc = this->getString("pvplugins.directory");
if(user_loc.empty())
{
g_log.debug("No ParaView plugin directory specified in the properties file.");
return; // it didn't work
}
pv_plugin_path = Poco::Path(user_loc);
pv_plugin_path = pv_plugin_path.absolute();
pv_plugin = Poco::File(pv_plugin_path.toString());
if (!pv_plugin.exists() || !pv_plugin.isDirectory())
Expand Down Expand Up @@ -1671,7 +1684,7 @@ bool ConfigServiceImpl::quickParaViewCheck() const

try
{
//Try to run "paraview --help", which will succeed if ParaView is installed.
//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())
Expand All @@ -1680,9 +1693,9 @@ bool ConfigServiceImpl::quickParaViewCheck() const
cmd = paraviewExe.toString();
}
std::vector<std::string> args;
args.push_back("--help");
args.push_back("-V");
Poco::Pipe outPipe;
Poco::ProcessHandle ph = Poco::Process::launch(cmd, args, 0, &outPipe, 0);
Poco::ProcessHandle ph = Poco::Process::launch(cmd, args, 0, &outPipe, &outPipe);
const int rc = ph.wait();
if(rc == 1)
{
Expand Down

0 comments on commit 6bc1fa4

Please sign in to comment.