]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
Correction of bug when the file does not exist. V5_1_5rc1
authorageay <ageay>
Tue, 26 Oct 2010 10:07:18 +0000 (10:07 +0000)
committerageay <ageay>
Tue, 26 Oct 2010 10:07:18 +0000 (10:07 +0000)
src/MEDLoader/MEDLoaderBase.cxx

index 057c2869d6a83bcd2983b89296c557d338736342..14c33ac1ed3ef57ac07ec50844f84d2f860065bc 100644 (file)
@@ -31,38 +31,17 @@ int MEDLoaderBase::getStatusOfFile(const char *fileName)
 {
   std::ifstream ifs;
   ifs.open(fileName);
-  unsigned int res=0;
   if((ifs.rdstate() & std::ifstream::failbit)!=0)
     {
-      res+=1;
       ifs.close();
+      return NOT_EXIST;
     }
   std::ofstream ofs(fileName,std::ios_base::app);
   if((ofs.rdstate() & std::ofstream::failbit)!=0)
     {
-      ofs.close();
-      res+=2;
-    }
-  switch(res)
-    {
-    case 0:
-      return EXIST_RW;
-    case 1:
-      {
-        std::ifstream ifs2;
-        ifs2.open(fileName);
-        if((ifs2.rdstate() & std::ifstream::failbit)!=0)
-          return EXIST_WRONLY;
-        else
-          return NOT_EXIST;
-      }
-    case 2:
       return EXIST_RDONLY;
-    case 3:
-      return DIR_LOCKED;
-    default:
-      throw INTERP_KERNEL::Exception("Internal error !");
     }
+  return EXIST_RW;
 }
 
 char *MEDLoaderBase::buildEmptyString(int lgth)