diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2009-04-02 16:56:04 (GMT) |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2009-04-02 16:56:04 (GMT) |
commit | 87d9469e428296a2fb8d0f266900cdfe816eaf0a (patch) | |
tree | f8219cadd57c0013f619030b44068adc009e2058 /src/corelib/io | |
parent | ceb253c234f840f7aeec10fa4450e840c6b242f4 (diff) | |
parent | 7c09fda559760b8488d3130a5932fee04b2f6979 (diff) | |
download | Qt-87d9469e428296a2fb8d0f266900cdfe816eaf0a.zip Qt-87d9469e428296a2fb8d0f266900cdfe816eaf0a.tar.gz Qt-87d9469e428296a2fb8d0f266900cdfe816eaf0a.tar.bz2 |
Merge branch '4.5' of git@scm.dev.nokia.troll.no:qt/qt
Conflicts:
tools/linguist/shared/profileevaluator.cpp
Diffstat (limited to 'src/corelib/io')
-rw-r--r-- | src/corelib/io/qfile.cpp | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp index d8f08c9..d7da800 100644 --- a/src/corelib/io/qfile.cpp +++ b/src/corelib/io/qfile.cpp @@ -712,6 +712,9 @@ QFile::rename(const QString &newName) if(error() == QFile::NoError) { if (fileEngine()->rename(newName)) { unsetError(); + // engine was able to handle the new name so we just reset it + fileEngine()->setFileName(newName); + d->fileName = newName; return true; } @@ -731,10 +734,18 @@ QFile::rename(const QString &newName) } if (read == -1) { d->setError(QFile::RenameError, in.errorString()); - return true; + error = true; + } + if(!error) { + if (!in.remove()) { + d->setError(QFile::RenameError, tr("Cannot remove source file")); + error = true; + } } - if(!error) - in.remove(); + if (error) + out.remove(); + else + setFileName(newName); return !error; } } @@ -889,7 +900,10 @@ QFile::copy(const QString &newName) error = true; d->setError(QFile::CopyError, tr("Cannot create %1 for output").arg(newName)); } -#ifndef QT_NO_TEMPORARYFILE +#ifdef QT_NO_TEMPORARYFILE + if (error) + out.remove(); +#else if (!error) out.setAutoRemove(false); #endif |