Fix QFile::copy() on WinRT.
Implementation of QFileSystemEngine::copyFile() uses CopyFile2() as if it is CopyFile() function, but CopyFile2() returns HRESULT, not BOOL. So the success should be checked by "SUCCEEDED()" instead of "!= 0". Current implementation does exactly the opposite because S_OK == 0. Change-Id: I0677d54447d22366fb2031e0b928a3d10e24c0ed Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
This commit is contained in:
parent
c09008d27c
commit
1c456751b3
@ -1416,8 +1416,9 @@ bool QFileSystemEngine::copyFile(const QFileSystemEntry &source, const QFileSyst
|
||||
COPYFILE2_EXTENDED_PARAMETERS copyParams = {
|
||||
sizeof(copyParams), COPY_FILE_FAIL_IF_EXISTS, NULL, NULL, NULL
|
||||
};
|
||||
bool ret = ::CopyFile2((const wchar_t*)source.nativeFilePath().utf16(),
|
||||
(const wchar_t*)target.nativeFilePath().utf16(), ©Params) != 0;
|
||||
HRESULT hres = ::CopyFile2((const wchar_t*)source.nativeFilePath().utf16(),
|
||||
(const wchar_t*)target.nativeFilePath().utf16(), ©Params);
|
||||
bool ret = SUCCEEDED(hres);
|
||||
#endif // Q_OS_WINRT
|
||||
if(!ret)
|
||||
error = QSystemError(::GetLastError(), QSystemError::NativeError);
|
||||
|
Loading…
Reference in New Issue
Block a user