summaryrefslogtreecommitdiffstats
path: root/src/corelib/io
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@digia.com>2015-02-25 20:43:12 +0100
committerAndy Shaw <andy.shaw@digia.com>2015-02-26 20:16:05 +0000
commita782369071db1d89448c0b94248d31fa877bcf8c (patch)
tree6e0d1c0a96ed0c9d447005c98b7cbe5bbc590c05 /src/corelib/io
parent4054f8a5ad9388143041fe8c43ee7abaaf7b78fa (diff)
Delete the file that we will move to not the new file before moving
In the case of Windows Embedded Compact we need to delete the destination file before doing the move if DeleteAndRenameFile has failed since MoveFile will fail if the destination file exists. Change-Id: I29d04c147bf8b6b5de850fd7da7bb3dc6a827f1d Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Diffstat (limited to 'src/corelib/io')
-rw-r--r--src/corelib/io/qfsfileengine_win.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp
index a1ab8fc0f8..ea2b1bbc63 100644
--- a/src/corelib/io/qfsfileengine_win.cpp
+++ b/src/corelib/io/qfsfileengine_win.cpp
@@ -544,7 +544,7 @@ bool QFSFileEngine::renameOverwrite(const QString &newName)
bool ret = ::DeleteAndRenameFile((wchar_t*)QFileSystemEntry(newName).nativeFilePath().utf16(),
(wchar_t*)d->fileEntry.nativeFilePath().utf16()) != 0;
if (!ret) {
- ret = ::DeleteFile((wchar_t*)d->fileEntry.nativeFilePath().utf16()) != 0;
+ ret = ::DeleteFile((wchar_t*)QFileSystemEntry(newName).nativeFilePath().utf16()) != 0;
if (ret)
ret = ::MoveFile((wchar_t*)d->fileEntry.nativeFilePath().utf16(),
(wchar_t*)QFileSystemEntry(newName).nativeFilePath().utf16()) != 0;