summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qfilesystemengine_win.cpp
diff options
context:
space:
mode:
authorJohn Preston <johnprestonmail@gmail.com>2016-04-27 18:40:56 +0300
committerMaurice Kalinowski <maurice.kalinowski@qt.io>2016-05-02 12:18:36 +0000
commit1c456751b35ded269663d63015b8078bab283b93 (patch)
tree8e71414e6b18ab6a6bb89cbea397193f4b1ac807 /src/corelib/io/qfilesystemengine_win.cpp
parentc09008d27ca1456fb53a3fc9c71d5f88b1081221 (diff)
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>
Diffstat (limited to 'src/corelib/io/qfilesystemengine_win.cpp')
-rw-r--r--src/corelib/io/qfilesystemengine_win.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp
index f1a6019094..e55ab0b544 100644
--- a/src/corelib/io/qfilesystemengine_win.cpp
+++ b/src/corelib/io/qfilesystemengine_win.cpp
@@ -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(), &copyParams) != 0;
+ HRESULT hres = ::CopyFile2((const wchar_t*)source.nativeFilePath().utf16(),
+ (const wchar_t*)target.nativeFilePath().utf16(), &copyParams);
+ bool ret = SUCCEEDED(hres);
#endif // Q_OS_WINRT
if(!ret)
error = QSystemError(::GetLastError(), QSystemError::NativeError);