From cb3b760759aa8c3cee9a3e7936073faec55df30d Mon Sep 17 00:00:00 2001 From: ffskyfan Date: Sun, 4 Jan 2015 16:43:10 +0800 Subject: [PATCH] Update CCFileUtils-win32.cpp fix the problem that engine can't get data from file while other app using the file on windows platform --- cocos/platform/win32/CCFileUtils-win32.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cocos/platform/win32/CCFileUtils-win32.cpp b/cocos/platform/win32/CCFileUtils-win32.cpp index b4e1f936d0..64fb66189b 100644 --- a/cocos/platform/win32/CCFileUtils-win32.cpp +++ b/cocos/platform/win32/CCFileUtils-win32.cpp @@ -147,7 +147,7 @@ static Data getData(const std::string& filename, bool forString) WCHAR wszBuf[CC_MAX_PATH] = {0}; MultiByteToWideChar(CP_UTF8, 0, fullPath.c_str(), -1, wszBuf, sizeof(wszBuf)/sizeof(wszBuf[0])); - HANDLE fileHandle = ::CreateFileW(wszBuf, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, NULL, nullptr); + HANDLE fileHandle = ::CreateFileW(wszBuf, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, NULL, nullptr); CC_BREAK_IF(fileHandle == INVALID_HANDLE_VALUE); size = ::GetFileSize(fileHandle, nullptr); @@ -222,7 +222,7 @@ unsigned char* FileUtilsWin32::getFileData(const std::string& filename, const ch WCHAR wszBuf[CC_MAX_PATH] = {0}; MultiByteToWideChar(CP_UTF8, 0, fullPath.c_str(), -1, wszBuf, sizeof(wszBuf)/sizeof(wszBuf[0])); - HANDLE fileHandle = ::CreateFileW(wszBuf, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, NULL, nullptr); + HANDLE fileHandle = ::CreateFileW(wszBuf, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, NULL, nullptr); CC_BREAK_IF(fileHandle == INVALID_HANDLE_VALUE); *size = ::GetFileSize(fileHandle, nullptr);