From: ageay Date: Tue, 26 Oct 2010 10:07:18 +0000 (+0000) Subject: Correction of bug when the file does not exist. X-Git-Tag: V5_1_5~8 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e509abf786d26a16a38e8c2b7b0bea0800b0b8dc;p=tools%2Fmedcoupling.git Correction of bug when the file does not exist. --- diff --git a/src/MEDLoader/MEDLoaderBase.cxx b/src/MEDLoader/MEDLoaderBase.cxx index 057c2869d..14c33ac1e 100644 --- a/src/MEDLoader/MEDLoaderBase.cxx +++ b/src/MEDLoader/MEDLoaderBase.cxx @@ -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)