mirror of
https://github.com/FWGS/xash3d-fwgs
synced 2024-11-22 01:45:19 +01:00
filesystem: request win32 error string in wide chars and then transform it to UTF-8 using our utflib
This commit is contained in:
parent
a1191eb4ab
commit
64716e6b42
@ -1845,10 +1845,13 @@ int FS_SetCurrentDirectory( const char *path )
|
||||
#if XASH_WIN32
|
||||
if( !SetCurrentDirectoryW( FS_PathToWideChar( path )))
|
||||
{
|
||||
const DWORD fm_flags = FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_MAX_WIDTH_MASK;
|
||||
DWORD errorcode;
|
||||
wchar_t wide_buf[1024];
|
||||
char buf[1024];
|
||||
FormatMessageA( FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||
NULL, GetLastError(), MAKELANGID( LANG_ENGLISH, SUBLANG_DEFAULT ),
|
||||
buf, sizeof( buf ), NULL );
|
||||
|
||||
FormatMessageW( fm_flags, NULL, GetLastError(), 0, wide_buf, sizeof( wide_buf ) / sizeof( wide_buf[0] ), NULL );
|
||||
Q_UTF16ToUTF8( buf, sizeof( buf ), wide_buf, sizeof( wide_buf ) / sizeof( wide_buf[0] ));
|
||||
|
||||
Sys_Error( "Changing directory to %s failed: %s\n", path, buf );
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user