diff options
author | João Abecasis <joao@abecasis.name> | 2009-05-18 11:08:04 (GMT) |
---|---|---|
committer | João Abecasis <joao@abecasis.name> | 2009-05-22 12:33:47 (GMT) |
commit | ba706d2564f1181fa4cc596a46bb2a041c62c28f (patch) | |
tree | c2fda5fe83c047533e416d33f3042327018a6877 /src/corelib | |
parent | 1044e75822270d702a3e9f14a87954321984c942 (diff) | |
download | Qt-ba706d2564f1181fa4cc596a46bb2a041c62c28f.zip Qt-ba706d2564f1181fa4cc596a46bb2a041c62c28f.tar.gz Qt-ba706d2564f1181fa4cc596a46bb2a041c62c28f.tar.bz2 |
QTemporaryFile: really close files before renaming
This gets temporary file renaming working on Windows, without requiring
block-copying.
While we could #ifdef this behavior for Windows, it's preferrable to
maintain consistency in the exposed interface.
Reviewed-by: Thiago
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/io/qtemporaryfile.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp index 564ec59..7c0b018 100644 --- a/src/corelib/io/qtemporaryfile.cpp +++ b/src/corelib/io/qtemporaryfile.cpp @@ -303,6 +303,7 @@ public: bool open(QIODevice::OpenMode flags); bool remove(); + bool rename(const QString &newName); bool close(); bool filePathIsTemplate; @@ -401,6 +402,12 @@ bool QTemporaryFileEngine::remove() return false; } +bool QTemporaryFileEngine::rename(const QString &newName) +{ + QFSFileEngine::close(); + return QFSFileEngine::rename(newName); +} + bool QTemporaryFileEngine::close() { // Don't close the file, just seek to the front. |