Mercurial > hg > forks > UniversalIndentGUI
changeset 699:90002ae3ddc9
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
author | thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282> |
---|---|
date | Tue, 02 Jun 2009 14:35:35 +0000 |
parents | 3499ddb0f61f |
children | f6a5c8c3cf36 |
files | src/SettingsPaths.cpp |
diffstat | 1 files changed, 11 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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."; }