]> git.sesse.net Git - vlc/commitdiff
Win32: fix file://localhost/... to path conversion
authorRémi Denis-Courmont <remi@remlab.net>
Fri, 26 Aug 2011 15:03:26 +0000 (18:03 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Fri, 26 Aug 2011 15:01:43 +0000 (18:01 +0300)
Pointed-out-by: Michael A. Puls II
src/text/strings.c

index 0666cfd9b6948609f7354117edd3ac1e2357ac39..0b5d828bc1ea362a1886c74bdc9af11e4090d1c7 100644 (file)
@@ -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