Unlock RW access to opened files on windows (#7161)
* Unlock RW access to opened files on windows * Add missing include
This commit is contained in:
parent
90a5d989e7
commit
680e132318
1 changed files with 7 additions and 7 deletions
|
@ -24,6 +24,7 @@
|
||||||
// windows.h needs to be included before other windows headers
|
// windows.h needs to be included before other windows headers
|
||||||
#include <direct.h> // getcwd
|
#include <direct.h> // getcwd
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
|
#include <share.h>
|
||||||
#include <shellapi.h>
|
#include <shellapi.h>
|
||||||
#include <shlobj.h> // for SHGetFolderPath
|
#include <shlobj.h> // for SHGetFolderPath
|
||||||
#include <tchar.h>
|
#include <tchar.h>
|
||||||
|
@ -1058,14 +1059,13 @@ bool IOFile::Open() {
|
||||||
Close();
|
Close();
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (flags != 0) {
|
if (flags == 0) {
|
||||||
m_file = _wfsopen(Common::UTF8ToUTF16W(filename).c_str(),
|
flags = _SH_DENYNO;
|
||||||
Common::UTF8ToUTF16W(openmode).c_str(), flags);
|
|
||||||
m_good = m_file != nullptr;
|
|
||||||
} else {
|
|
||||||
m_good = _wfopen_s(&m_file, Common::UTF8ToUTF16W(filename).c_str(),
|
|
||||||
Common::UTF8ToUTF16W(openmode).c_str()) == 0;
|
|
||||||
}
|
}
|
||||||
|
m_file = _wfsopen(Common::UTF8ToUTF16W(filename).c_str(),
|
||||||
|
Common::UTF8ToUTF16W(openmode).c_str(), flags);
|
||||||
|
m_good = m_file != nullptr;
|
||||||
|
|
||||||
#elif ANDROID
|
#elif ANDROID
|
||||||
// Check whether filepath is startsWith content
|
// Check whether filepath is startsWith content
|
||||||
AndroidStorage::AndroidOpenMode android_open_mode = AndroidStorage::ParseOpenmode(openmode);
|
AndroidStorage::AndroidOpenMode android_open_mode = AndroidStorage::ParseOpenmode(openmode);
|
||||||
|
|
Loading…
Reference in a new issue