From: bri Date: Fri, 8 Feb 2013 10:58:56 +0000 (+0000) Subject: MPV : Remove temporary directory if the removed temporary file is the last one in it X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=dc48cfa2c3a8146bfc62e527ff75302e47da49ed;p=modules%2Fkernel.git MPV : Remove temporary directory if the removed temporary file is the last one in it --- diff --git a/src/Container/SALOME_DataContainer_i.cxx b/src/Container/SALOME_DataContainer_i.cxx index 965b4047c..6bbc41b0b 100644 --- a/src/Container/SALOME_DataContainer_i.cxx +++ b/src/Container/SALOME_DataContainer_i.cxx @@ -86,11 +86,15 @@ Engines::TMPFile* Engines_DataContainer_i::get() aFile.close(); // remove file after it converted to a stream + // also remove directory of the file if it is empty if (myRemoveAfterGet) { + string aDirName = myURL.substr(0, myURL.find_last_of("/\\")); #ifdef WIN32 DeleteFile(myURL.c_str()); + RemoveDirectory(aDirName.c_str()); #else unlink(myURL.c_str()); + rmdir(aDirName.c_str()); #endif } }