Commit b8433e0d authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont
Browse files

Support filenames outside the ANSI Code Page

parent 11566f0a
......@@ -445,17 +445,35 @@ static int open_file (access_t *p_access, const char *psz_name)
p_access->info.i_update |= INPUT_UPDATE_SIZE;
fseek( p_sys->fd, 0, SEEK_SET );
#else
const char *psz_localname = ToLocale (path);
if (psz_localname == NULL)
int fd = -1;
# if defined (WIN32)
if (GetVersion() < 0x80000000)
{
msg_Err (p_access, "incorrect file name %s", psz_name);
free (path);
return -1;
/* for Windows NT and above */
wchar_t wpath[MAX_PATH + 1];
if (!MultiByteToWideChar (CP_UTF8, 0, path, -1, wpath, MAX_PATH))
{
msg_Err (p_access, "incorrect file name %s", psz_name);
return VLC_EGENERIC;
}
wpath[MAX_PATH] = L'\0';
fd = _wopen( wpath, O_NONBLOCK );
}
else
# endif
{
const char *psz_localname = ToLocale (path);
if (psz_localname == NULL)
{
msg_Err (p_access, "incorrect file name %s", psz_name);
free (path);
return -1;
}
// FIXME: support non-ANSI filenames on Win32
int fd = open (path, O_NONBLOCK /*| O_LARGEFILE*/);
LocaleFree (psz_localname);
fd = open (path, O_NONBLOCK /*| O_LARGEFILE*/);
LocaleFree (psz_localname);
}
free (path);
if (fd == -1)
......
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