forked from teamnwah/openmw-tes3coop
tinyxml convert path to UTF-16 on Windows
This commit is contained in:
parent
130349e0cd
commit
a46662043a
1 changed files with 20 additions and 5 deletions
25
extern/oics/tinyxml.cpp
vendored
25
extern/oics/tinyxml.cpp
vendored
|
@ -31,18 +31,33 @@ distribution.
|
|||
|
||||
#include "tinyxml.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <Windows.h>
|
||||
#endif
|
||||
|
||||
|
||||
bool TiXmlBase::condenseWhiteSpace = true;
|
||||
|
||||
// Microsoft compiler security
|
||||
FILE* TiXmlFOpen( const char* filename, const char* mode )
|
||||
{
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1400 )
|
||||
#if defined(_WIN32)
|
||||
FILE* fp = 0;
|
||||
errno_t err = fopen_s( &fp, filename, mode );
|
||||
if ( !err && fp )
|
||||
return fp;
|
||||
return 0;
|
||||
size_t len = strlen(filename);
|
||||
wchar_t *wname = new wchar_t[len]
|
||||
wchar_t wmode[32] = { 0 };
|
||||
|
||||
MultiByteToWideChar(CP_UTF8, 0, filename, len, wname, len);
|
||||
MultiByteToWideChar(CP_UTF8, 0, mode, -1, wmode, sizeof(wmode) / sizeof(*wmode));
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1400 )
|
||||
errno_t err = _wfopen_s( &fp, wname, wmode );
|
||||
#else
|
||||
fp = _wfopen(wname, wmode)
|
||||
#endif
|
||||
delete[] wname;
|
||||
|
||||
return fp;
|
||||
#else
|
||||
return fopen( filename, mode );
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue