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

Win32: fix file://localhost/... to path conversion

Pointed-out-by: Michael A. Puls II
parent 806505a4
......@@ -1206,23 +1206,24 @@ char *make_path (const char *url)
if (schemelen == 4 && !strncasecmp (url, "file", 4))
{
#if (DIR_SEP_CHAR != '/')
for (char *p = strchr (path, '/'); p; p = strchr (p + 1, '/'))
*p = DIR_SEP_CHAR;
#endif
/* Leading slash => local path */
if (*path == DIR_SEP_CHAR)
#if (!defined (WIN32) && !defined (__OS2__)) || defined (UNDER_CE)
/* Leading slash => local path */
if (*path == '/')
return path;
#else
return memmove (path, path + 1, strlen (path + 1) + 1);
#endif
/* Local path disguised as a remote one (MacOS X) */
if (!strncasecmp (path, "localhost"DIR_SEP, 10))
/* Local path disguised as a remote one */
if (!strncasecmp (path, "localhost/", 10))
return memmove (path, path + 9, strlen (path + 9) + 1);
#else
for (char *p = strchr (path, '/'); p; p = strchr (p + 1, '/'))
*p = '\\';
#if defined( WIN32 ) || defined( __OS2__ )
/* Leading backslash => local path */
if (*path == '\\')
return memmove (path, path + 1, strlen (path + 1) + 1);
/* Local path disguised as a remote one */
if (!strncasecmp (path, "localhost\\", 10))
return memmove (path, path + 10, strlen (path + 10) + 1);
/* UNC path */
if (*path && asprintf (&ret, "\\\\%s", path) == -1)
ret = NULL;
#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