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>
This commit is contained in:
parent
88550543f8
commit
227bb20ded
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user