]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
MPV : Remove temporary directory if the removed temporary file is the last one in it
authorbri <bri@opencascade.com>
Fri, 8 Feb 2013 10:58:56 +0000 (10:58 +0000)
committerbri <bri@opencascade.com>
Fri, 8 Feb 2013 10:58:56 +0000 (10:58 +0000)
src/Container/SALOME_DataContainer_i.cxx

index 965b4047c7b0ffb71d622678662c0eb2db1059e5..6bbc41b0bfebc7cdcd650741b9cc9dab043d9d5d 100644 (file)
@@ -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
       }
     }