# HG changeset patch # User thomas_-_s # Date 1243953335 0 # Node ID 90002ae3ddc97265cdaff7a9217bebefa753e542 # Parent 3499ddb0f61f051bf1c12c2ac80ba31559c0b868 Added warning outputs to the temp dir cleanup function and corrected a comment. git-svn-id: svn://svn.code.sf.net/p/universalindent/code/trunk@968 59b1889a-e5ac-428c-b0c7-476e01d41282 diff -r 3499ddb0f61f -r 90002ae3ddc9 src/SettingsPaths.cpp --- a/src/SettingsPaths.cpp Tue Jun 02 14:34:36 2009 +0000 +++ b/src/SettingsPaths.cpp Tue Jun 02 14:35:35 2009 +0000 @@ -227,7 +227,7 @@ /*! - \brief Returns true if portable mode shall be used. + \brief Completely deletes the created temporary directory with all of its content. */ void SettingsPaths::cleanAndRemoveTempDir() { QDirIterator dirIterator(tempPath, QDirIterator::Subdirectories); @@ -245,7 +245,10 @@ // since it must be empty. if ( !directoryStack.isEmpty() && !currentDirOrFile.startsWith(directoryStack.top()) ) { QString dirToBeRemoved = directoryStack.pop(); - noErrorsOccurred &= QDir(dirToBeRemoved).rmdir(dirToBeRemoved); + bool couldRemoveDir = QDir(dirToBeRemoved).rmdir(dirToBeRemoved); + noErrorsOccurred &= couldRemoveDir; + if ( couldRemoveDir == false ) + qWarning() << __LINE__ << " " << __FUNCTION__ << "Could not remove the directory: " << dirToBeRemoved; //qDebug() << "Removing Dir " << directoryStack.pop(); } @@ -256,11 +259,15 @@ } // otherwise it must be a file, so delete it. else { - noErrorsOccurred &= QFile::remove( currentDirOrFile ); + bool couldRemoveFile = QFile::remove( currentDirOrFile ); + noErrorsOccurred &= couldRemoveFile; + if ( couldRemoveFile == false ) + qWarning() << __LINE__ << " " << __FUNCTION__ << "Could not remove the file: " << currentDirOrFile; //qDebug() << "Removing File " << currentDirOrFile; } } } noErrorsOccurred &= QDir(tempPath).rmdir(tempPath); - //qDebug() << "Removing tempPath " << tempPath; + if ( noErrorsOccurred == false ) + qWarning() << __LINE__ << " " << __FUNCTION__ << "While cleaning up the temp dir an error occurred."; }