From: sln Date: Fri, 21 Sep 2012 08:55:38 +0000 (+0000) Subject: FreeTemoraryFiles() method added to free locked directory with temporary files (its... X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e9bf2c2b2cda5641b1545cc5bacfa4951aa04585;p=modules%2Fgui.git FreeTemoraryFiles() method added to free locked directory with temporary files (its is needed for DIAGRAM module to rename the folder) --- diff --git a/src/LightApp/LightApp_Driver.cxx b/src/LightApp/LightApp_Driver.cxx index 15bf14521..b534201aa 100644 --- a/src/LightApp/LightApp_Driver.cxx +++ b/src/LightApp/LightApp_Driver.cxx @@ -344,20 +344,7 @@ void LightApp_Driver::RemoveTemporaryFiles( const char* theModuleName, const boo // aFiles must contain temporary directory name in its first item // and names of files (relatively the temporary directory) in the others - if ( myBloc ) - { - fclose( myBloc ); - QString fName = Qtx::addSlash( aFiles.front().c_str() ) + "used_by_salome"; - QFile::remove( fName ); - } -#ifndef WIN32 - if ( myBlocFcntl ) - { - fclose( myBlocFcntl ); - QString fName = Qtx::addSlash( aFiles.front().c_str() ) + "used_by_salome.fcntl"; - QFile::remove( fName ); - } -#endif + FreeTemporaryFiles( theModuleName ); RemoveFiles( aFiles, IsDirDeleted ); @@ -931,3 +918,27 @@ void LightApp_Driver::PutNextStreamToFiles( ListOfFiles& theListOfFiles, } } // for } + +/*! + Free locked directory with temporary files +*/ +void LightApp_Driver::FreeTemporaryFiles( const char* theModuleName ) +{ + std::string aModuleName(theModuleName); + ListOfFiles aFiles = myMap[aModuleName]; + + if ( myBloc ) + { + fclose( myBloc ); + QString fName = Qtx::addSlash( aFiles.front().c_str() ) + "used_by_salome"; + QFile::remove( fName ); + } +#ifndef WIN32 + if ( myBlocFcntl ) + { + fclose( myBlocFcntl ); + QString fName = Qtx::addSlash( aFiles.front().c_str() ) + "used_by_salome.fcntl"; + QFile::remove( fName ); + } +#endif +} diff --git a/src/LightApp/LightApp_Driver.h b/src/LightApp/LightApp_Driver.h index 1ef96c4e8..eeb726bfd 100644 --- a/src/LightApp/LightApp_Driver.h +++ b/src/LightApp/LightApp_Driver.h @@ -57,6 +57,8 @@ public: virtual void ClearDriverContents(); + void FreeTemporaryFiles( const char* theModuleName ); + protected: /* void PutFilesToStream(const std::string& theModuleName, unsigned char*& theBuffer,