mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 19:19:56 +00:00
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
23
extern/oics/tinyxml.cpp
vendored
23
extern/oics/tinyxml.cpp
vendored
|
@ -31,18 +31,33 @@ distribution.
|
||||||
|
|
||||||
#include "tinyxml.h"
|
#include "tinyxml.h"
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include <Windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
bool TiXmlBase::condenseWhiteSpace = true;
|
bool TiXmlBase::condenseWhiteSpace = true;
|
||||||
|
|
||||||
// Microsoft compiler security
|
// Microsoft compiler security
|
||||||
FILE* TiXmlFOpen( const char* filename, const char* mode )
|
FILE* TiXmlFOpen( const char* filename, const char* mode )
|
||||||
{
|
{
|
||||||
#if defined(_MSC_VER) && (_MSC_VER >= 1400 )
|
#if defined(_WIN32)
|
||||||
FILE* fp = 0;
|
FILE* fp = 0;
|
||||||
errno_t err = fopen_s( &fp, filename, mode );
|
size_t len = strlen(filename);
|
||||||
if ( !err && fp )
|
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;
|
return fp;
|
||||||
return 0;
|
|
||||||
#else
|
#else
|
||||||
return fopen( filename, mode );
|
return fopen( filename, mode );
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue