Salome HOME
CEA18933 : As before, when non managed version requested, ignore and take the latest
authorAnthony Geay <anthony.geay@edf.fr>
Mon, 6 Apr 2020 19:53:23 +0000 (21:53 +0200)
committerAnthony Geay <anthony.geay@edf.fr>
Mon, 6 Apr 2020 19:53:23 +0000 (21:53 +0200)
src/MEDWrapper/MED_Factory.cxx

index 278838a0c3b89e9933b22496820f56b34e6ac007..af7285801e58c154cdb13eca308c1276a65cfeac 100644 (file)
@@ -196,13 +196,13 @@ namespace MED
     }
     med_int wantedMajor = MED_MAJOR_NUM;
     med_int wantedMinor = MED_MINOR_NUM;
-    if (isCreated)
+    // when non managed version of file is requested : ignore it and take the latest version
+    std::vector<int> versionsOK(GetMEDVersionsAppendCompatible());
+    bool isVersionRequestedOK(std::find(versionsOK.begin(),versionsOK.end(),theVersion)!=versionsOK.end());
+    if (isCreated && isVersionRequestedOK)
     {
-      if (theVersion > 0)
-      {
-        wantedMajor = theVersion/10;
-        wantedMinor = theVersion%10;
-      }
+      wantedMajor = theVersion/10;
+      wantedMinor = theVersion%10;
     }
     return new MED::TWrapper(fileName, true, wantedMajor, wantedMinor);
   }