renameOverwrite: don't allow cross-partition copying

This matches the Unix behavior, and ensures atomicity (as required by QSaveFile)

Change-Id: I54ec98bcd7a0714ca968cad627a5e4d684fd7af6
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
bb10
David Faure 2013-03-22 11:08:01 +01:00 committed by The Qt Project
parent 98e704a2da
commit ab340e89fd
1 changed files with 1 additions and 1 deletions

View File

@ -522,7 +522,7 @@ bool QFSFileEngine::renameOverwrite(const QString &newName)
Q_D(QFSFileEngine);
bool ret = ::MoveFileEx((wchar_t*)d->fileEntry.nativeFilePath().utf16(),
(wchar_t*)QFileSystemEntry(newName).nativeFilePath().utf16(),
MOVEFILE_REPLACE_EXISTING | MOVEFILE_COPY_ALLOWED) != 0;
MOVEFILE_REPLACE_EXISTING) != 0;
if (!ret)
setError(QFile::RenameError, QSystemError(::GetLastError(), QSystemError::NativeError).toString());
return ret;