Commit d057acfb authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Support opening of non ANSI filenames on Win32

parent 19ee0a8c
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
*****************************************************************************/ *****************************************************************************/
FILE *vlc_fopen( const char *filename, const char *mode ) FILE *vlc_fopen( const char *filename, const char *mode )
{ {
#if !defined WIN32 /*|| !defined UNICODE*/
const char *local_name = ToLocale( filename ); const char *local_name = ToLocale( filename );
if( local_name != NULL ) if( local_name != NULL )
...@@ -42,6 +43,16 @@ FILE *vlc_fopen( const char *filename, const char *mode ) ...@@ -42,6 +43,16 @@ FILE *vlc_fopen( const char *filename, const char *mode )
return stream; return stream;
} }
return NULL; return NULL;
#else
wchar_t wpath[MAX_PATH];
wchar_t wmode[4];
if( !MultiByteToWideChar( CP_UTF8, 0, filename, -1, wpath, MAX_PATH - 1)
|| !MultiByteToWideChar( CP_ACP, 0, mode, -1, wmode, 3 ) )
return NULL;
return _wfopen( wpath, wmode );
#endif
} }
/***************************************************************************** /*****************************************************************************
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment