Commit e33a82db authored by Geoffroy Couprie's avatar Geoffroy Couprie
Browse files

Win32: fix #2592 (stdin file input). It may impact other platforms, so please...

Win32: fix #2592 (stdin file input). It may impact other platforms, so please test, and fix/revert if you see a bug.
parent c2e29f67
......@@ -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://");
......
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