From f7f13139d540b889dd5db01d4e6e6c4470a910a5 Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Mon, 25 Sep 2017 08:21:28 +0200 Subject: [PATCH] Make salome share the same pv server configuration than those with salome shell paraview --- src/PVViewer/PVViewer_Core.cxx | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/PVViewer/PVViewer_Core.cxx b/src/PVViewer/PVViewer_Core.cxx index 993d6b249..6e9e69203 100644 --- a/src/PVViewer/PVViewer_Core.cxx +++ b/src/PVViewer/PVViewer_Core.cxx @@ -29,6 +29,7 @@ #include #include #include +#include #include @@ -65,7 +66,7 @@ bool PVViewer_Core::ParaviewInitApp(QMainWindow * aDesktop, LogWindow * logWindo char** argv = 0; QString aOptions = getenv("PARAVIEW_OPTIONS"); QStringList aOptList = aOptions.split(":", QString::SkipEmptyParts); - argv = new char*[aOptList.size() + 2]; + argv = new char*[aOptList.size() + 3]; QStringList args = QApplication::arguments(); argv[0] = (args.size() > 0)? strdup(args[0].toLatin1().constData()) : strdup("paravis"); argc++; @@ -75,6 +76,24 @@ bool PVViewer_Core::ParaviewInitApp(QMainWindow * aDesktop, LogWindow * logWindo argc++; } argv[argc++] = strdup("--multi-servers"); + // Make salome sharing the same server configuration than external one with "salome shell paraview" + QStringList li(QStandardPaths::standardLocations(QStandardPaths::ConfigLocation)); + foreach(QString pathConfig,li) + { + QFileInfo fi(QDir(pathConfig),QString("ParaView")); + if(fi.exists() && fi.isDir()) + { + QFileInfo fi2(fi.canonicalFilePath(),"servers.pvsc"); + if(fi2.exists() && fi2.isFile()) + { + QString addEntry(QString("--servers-file=%1").arg(fi2.canonicalFilePath())); + std::string addEntry2(addEntry.toStdString()); + argv[argc++] = strdup(addEntry2.c_str()); + break; + } + } + } + // MyCoreApp = new pqPVApplicationCore (argc, argv); if (MyCoreApp->getOptions()->GetHelpSelected() || MyCoreApp->getOptions()->GetUnknownArgument() || -- 2.39.2