diff options
author | Andy Shaw <andy.shaw@digia.com> | 2015-02-27 19:52:22 +0100 |
---|---|---|
committer | Andy Shaw <andy.shaw@digia.com> | 2015-03-04 10:00:34 +0000 |
commit | 227bb20dedc4156c1a4653d55252b0790fd1ae75 (patch) | |
tree | 82bb671421686601505ad4842f7d9b4b384fe956 /src | |
parent | 88550543f8b4b7c76bffeebb923ad1f72b774b6e (diff) | |
download | qtbase-227bb20dedc4156c1a4653d55252b0790fd1ae75.tar.gz |
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')
-rw-r--r-- | src/corelib/io/qfsfileengine_win.cpp | 2 |
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; } |