]> git.sesse.net Git - vlc/commitdiff
Win32: fix #2592 (stdin file input). It may impact other platforms, so please test...
authorGeoffroy Couprie <geal@videolan.org>
Fri, 25 Dec 2009 12:57:57 +0000 (13:57 +0100)
committerGeoffroy Couprie <geal@videolan.org>
Sat, 26 Dec 2009 15:20:59 +0000 (16:20 +0100)
src/text/strings.c

index 09c4ed1e4c3de5213104001abe94f3223fbf773d..b69c9e54f1805a84cbe18187f1722fbae9d368fd 100644 (file)
@@ -1100,16 +1100,28 @@ char *make_URI (const char *path)
     }
     else
     if (path[0] != DIR_SEP_CHAR)
-    {   /* Relative path: prepend the current working directory */
-        char cwd[PATH_MAX];
+    {
+        if(path[0] == '-')
+        {
+            /*reading from stdin*/
+            if (asprintf (&buf, "-") == -1)
+                return NULL;
 
-        if (getcwd (cwd, sizeof (cwd)) == NULL) /* FIXME: UTF8? */
-            return NULL;
-        if (asprintf (&buf, "%s/%s", cwd, path) == -1)
-            return NULL;
-        char *ret = make_URI (buf);
-        free (buf);
-        return ret;
+            return buf;
+        }
+        else
+        {
+            /* Relative path: prepend the current working directory */
+            char cwd[PATH_MAX];
+
+            if (getcwd (cwd, sizeof (cwd)) == NULL) /* FIXME: UTF8? */
+                return NULL;
+            if (asprintf (&buf, "%s/%s", cwd, path) == -1)
+                return NULL;
+            char *ret = make_URI (buf);
+            free (buf);
+            return ret;
+        }
     }
     else
         buf = strdup ("file://");