#ifndef WIN32
fName += ".fcntl";
+
+ if ( myBlocFcntl )
+ fclose( myBlocFcntl );
myBlocFcntl = fopen( fName.toLatin1().constData(), "w" );
-#endif
lockFcntl( QString() );
+#endif
}
+#ifndef WIN32
/*
* Lock theLF or myBlockFcntl if empty
* returns 0 on success
*/
int LightApp_Driver::lockFcntl( QString theLF )
{
-#ifdef WIN32
- return 0;
-#else
if ( theLF.isEmpty() && !myBlocFcntl )
return -2;
fLock.l_len = 0;
fLock.l_start = 0;
return fcntl( fileno( aFD ), F_SETLK, &fLock );
-#endif
-
}
-
+#endif
/*!
Remove files. First item in <theFiles> is a directory with slash at the end.
}
aDir.Remove();
}
+ //if ( IsDirDeleted )
+ //{
+// bool ok = Qtx::rmDir( QString( theFiles[0].c_str() ) );
+ // std::cout<<"\n DEBUG: rmdir "<<theFiles[0].c_str()<<" ok: "<<ok<<std::endl;
+ //}
+
}
/*!
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
RemoveFiles( aFiles, IsDirDeleted );
+
+ // if ( IsDirDeleted )
+ // {
+ // bool ok = Qtx::rmDir( QString( aFiles[0].c_str() ) );
+ // std::cout<<"\n DEBUG: rmdir "<<aFiles[0].c_str()<<" ok: "<<std::endl;
+ // }
}
/*!
if ( myBlocFcntl )
fclose( myBlocFcntl );
myBlocFcntl = fopen( blocName.toLatin1().constData(), "w" );
-#endif
lockFcntl( QString() );
-
-
-
+#endif
return aTmpDir.ToCString();
}
void SetIsTemporary( bool theFlag ) { myIsTemp = theFlag; }
bool IsTemporary() const { return myIsTemp; }
-
+#ifndef WIN32
int lockFcntl( QString theLF );
+#endif
protected:
typedef std::map<std::string, ListOfFiles> MapOfListOfFiles;
#include <unistd.h>
#include <fcntl.h>
#include <cerrno>
+
+#include <iostream>
#endif
#include "SUIT_Study.h"
#ifndef WIN32
used += ".fcntl";
myBFileFcntl = fopen( used.toLatin1().constData(), "w" );
-#endif
lockFcntl( QString() );
+#endif
}
}
+#ifndef WIN32
/*
* Lock theLF or myBFileFcntl if empty
* returns 0 on success
*/
int SUIT_Session::lockFcntl( QString theLF )
{
-#ifdef WIN32
- return 0;
-#else
if ( theLF.isEmpty() && !myBFileFcntl )
return -2;
QApplication::setOverrideCursor( Qt::WaitCursor );
// clear folder
- Qtx::rmDir( myBFolder );
- QDir().mkdir( myBFolder );
+ QDir tmpDir( myBFolder );
+ QFileInfoList aFolders = tmpDir.entryInfoList( QDir::Dirs|QDir::NoDotAndDotDot );
+
+ QFileInfoList::const_iterator aFoldersIt = aFolders.constBegin();
+ for ( ; aFoldersIt != aFolders.constEnd(); ++aFoldersIt )
+ {
+ Qtx::rmDir( (*aFoldersIt).absoluteFilePath() );
+ }
// create backup
QString aName;