summaryrefslogtreecommitdiffstats
path: root/src/corelib/io
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@digia.com>2015-02-27 19:52:22 +0100
committerAndy Shaw <andy.shaw@digia.com>2015-03-04 10:00:34 +0000
commit227bb20dedc4156c1a4653d55252b0790fd1ae75 (patch)
tree82bb671421686601505ad4842f7d9b4b384fe956 /src/corelib/io
parent88550543f8b4b7c76bffeebb923ad1f72b774b6e (diff)
Call MoveFile() anyway if the delete failed because it did not exist
Since the new filename might not yet exist and DeleteFile() will fail if the new file does not exist then MoveFile() should still be called. Change-Id: Id4576ade079ad8593f824b7100bb0d94aec1fa0a 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 ea2b1bbc63..a7ccfb2dea 100644
--- a/src/corelib/io/qfsfileengine_win.cpp
+++ b/src/corelib/io/qfsfileengine_win.cpp
@@ -545,7 +545,7 @@ bool QFSFileEngine::renameOverwrite(const QString &newName)
(wchar_t*)d->fileEntry.nativeFilePath().utf16()) != 0;
if (!ret) {
ret = ::DeleteFile((wchar_t*)QFileSystemEntry(newName).nativeFilePath().utf16()) != 0;
- if (ret)
+ if (ret || ::GetLastError() == ERROR_FILE_NOT_FOUND)
ret = ::MoveFile((wchar_t*)d->fileEntry.nativeFilePath().utf16(),
(wchar_t*)QFileSystemEntry(newName).nativeFilePath().utf16()) != 0;
}