From: vsr Date: Thu, 28 Mar 2019 11:54:46 +0000 (+0300) Subject: Issue !16751: [CEA16749] import MED 3.0 files in SMESH: exception X-Git-Tag: V9_3_0rc1~7 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3421298e040728675198d280425ba99395ca9641;p=modules%2Fsmesh.git Issue !16751: [CEA16749] import MED 3.0 files in SMESH: exception --- diff --git a/src/MEDWrapper/MED_Factory.cxx b/src/MEDWrapper/MED_Factory.cxx index 12c0f597a..c6d62d253 100644 --- a/src/MEDWrapper/MED_Factory.cxx +++ b/src/MEDWrapper/MED_Factory.cxx @@ -211,7 +211,7 @@ namespace MED if (!CheckCompatibility(fileName)) { EXCEPTION(std::runtime_error, "Cannot open file '"<Open(eLECTURE_ECRITURE, &aRet); - // if (aRet < 0) - // myFile->Close(); - // myFile->Open(eLECTURE_AJOUT, &aRet); - // } - if (aRet < 0) { - myFile->Close(); - myFile->Open(eLECTURE, &aRet); + if ( write ) { + myFile->Open(eLECTURE_ECRITURE, &aRet); + if (aRet < 0) { + myFile->Close(); + myFile->Open(eCREATION, &aRet); + } } - if (aRet < 0) { - myFile->Close(); - myFile->Open(eCREATION, &aRet); + else { + myFile->Open(eLECTURE, &aRet); } } diff --git a/src/MEDWrapper/MED_Wrapper.hxx b/src/MEDWrapper/MED_Wrapper.hxx index 7acbf4ce0..e236f206c 100644 --- a/src/MEDWrapper/MED_Wrapper.hxx +++ b/src/MEDWrapper/MED_Wrapper.hxx @@ -52,7 +52,7 @@ namespace MED TWrapper& operator=(const TWrapper&); public: - TWrapper(const std::string& theFileName, TInt theVersion=-1); + TWrapper(const std::string& theFileName, bool write, TInt theVersion=-1); virtual ~TWrapper();