Salome HOME
bos #18641 [CEA 18636][Windows] SMESH_MeshersList environment variable separator
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_HypothesesUtils.cxx
index 232c9296bbda97f4ded73bc26d3feb4ca5ed886f..2660647d3ed25affa0ab79abb3e6925e728d7598 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2019  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -67,6 +67,7 @@
  #define LoadLib( name ) LoadLibrary( name )
  #define GetProc GetProcAddress
  #define UnLoadLib( handle ) FreeLibrary( handle );
+ #define env_sep ";"
 #else // WIN32
  #define LibHandle void*
  #ifdef DYNLOAD_LOCAL
@@ -76,6 +77,7 @@
  #endif // DYNLOAD_LOCAL
  #define GetProc dlsym
  #define UnLoadLib( handle ) dlclose( handle );
+ #define env_sep ":"
 #endif // WIN32
 
 #ifdef _DEBUG_
@@ -197,7 +199,7 @@ namespace SMESH
       if (cenv)
         HypsXml.sprintf("%s", cenv);
 
-      QStringList HypsXmlList = HypsXml.split(":", QString::SkipEmptyParts);
+      QStringList HypsXmlList = HypsXml.split(env_sep, QString::SkipEmptyParts);
       if (HypsXmlList.count() == 0) {
         SUIT_MessageBox::critical(SMESHGUI::desktop(),
                                   QObject::tr("SMESH_WRN_WARNING"),
@@ -329,8 +331,7 @@ namespace SMESH
         hypoSet != myListOfHypothesesSets.end();
         ++hypoSet ) {
       HypothesesSet* aSet = *hypoSet;
-      if ( aSet && ( aSet->count( true ) || aSet->count( false )) &&
-          aSet->maxDim() <= maxDim)
+      if ( aSet && 0 <= aSet->maxDim() && aSet->maxDim() <= maxDim )
       {
         aSetNameList.append( mangledHypoSetName( aSet ));
       }
@@ -521,7 +522,22 @@ namespace SMESH
       try {
         // load plugin library
         if(MYDEBUG) MESSAGE("Loading client meshers plugin library ...");
-        LibHandle libHandle = LoadLib( aClientLibName.toUtf8().data() );
+#ifdef WIN32
+#ifdef UNICODE
+        LPTSTR path = new TCHAR[aClientLibName.length() + 1];
+        path[aClientLibName.toWCharArray(path)] = '\0';
+#else
+        QByteArray baPath = aClientLibName.toUtf8();
+        const char* path = baPath.data();
+#endif
+#else
+        QByteArray baPath = aClientLibName.toUtf8();
+        char* path = baPath.data();
+#endif
+        LibHandle libHandle = LoadLib( path );
+#if defined(WIN32) && defined(UNICODE)
+      delete path;
+#endif
         if (!libHandle) {
           // report any error, if occurred
           {
@@ -631,12 +647,6 @@ namespace SMESH
       try {
         CORBA::String_var error;
         res = aMesh->AddHypothesis(aShapeObject, aHyp, error.out());
-        if (res < SMESH::HYP_UNKNOWN_FATAL) {
-          _PTR(SObject) aSH = SMESH::FindSObject(aHyp);
-          if (SM && aSH) {
-            SMESH::ModifiedMesh(SM, false, aMesh->NbNodes()==0);
-          }
-        }
         if (res > SMESH::HYP_OK) {
           wc.suspend();
           processHypothesisStatus(res, aHyp, true, error.in() );
@@ -659,7 +669,7 @@ namespace SMESH
     int res = SMESH::HYP_UNKNOWN_FATAL;
     SUIT_OverrideCursor wc;
 
-    if (!aSubMesh->_is_nil() && ! aHyp->_is_nil()) {
+    if ( !aSubMesh->_is_nil() && !aHyp->_is_nil() ) {
       try {
         SMESH::SMESH_Mesh_var aMesh = aSubMesh->GetFather();
         _PTR(SObject) SsubM = SMESH::FindSObject(aSubMesh);
@@ -668,11 +678,6 @@ namespace SMESH
         {
           CORBA::String_var error;
           res = aMesh->AddHypothesis( aShapeObject, aHyp, error.out() );
-          if (res < SMESH::HYP_UNKNOWN_FATAL)  {
-            _PTR(SObject) meshSO = SMESH::FindSObject(aMesh);
-            if (meshSO)
-              SMESH::ModifiedMesh(meshSO, false, aMesh->NbNodes()==0);
-          }
           if (res > SMESH::HYP_OK) {
             wc.suspend();
             processHypothesisStatus( res, aHyp, true, error.in() );
@@ -763,9 +768,6 @@ namespace SMESH
           }
           if ( _PTR(SObject) meshSO = SMESH::FindSObject(aMesh) )
           {
-            if ( res < SMESH::HYP_UNKNOWN_FATAL )
-              SMESH::ModifiedMesh(meshSO, false, aMesh->NbNodes()==0);
-
             if ( SMESH_Actor* actor = SMESH::FindActorByEntry( meshSO->GetID().c_str() ))
               if( actor->GetVisibility() )
                 actor->Update();