From e9bf2c2b2cda5641b1545cc5bacfa4951aa04585 Mon Sep 17 00:00:00 2001 From: sln Date: Fri, 21 Sep 2012 08:55:38 +0000 Subject: [PATCH] FreeTemoraryFiles() method added to free locked directory with temporary files (its is needed for DIAGRAM module to rename the folder) --- src/LightApp/LightApp_Driver.cxx | 39 ++++++++++++++++++++------------ src/LightApp/LightApp_Driver.h | 2 ++ 2 files changed, 27 insertions(+), 14 deletions(-) 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, -- 2.39.2