From a782369071db1d89448c0b94248d31fa877bcf8c Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Wed, 25 Feb 2015 20:43:12 +0100 Subject: 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 --- src/corelib/io/qfsfileengine_win.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; -- cgit v1.2.3