aboutsummaryrefslogtreecommitdiffstats
path: root/src/serdi.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/serdi.c')
-rw-r--r--src/serdi.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/serdi.c b/src/serdi.c
index 38646a67..47118e8f 100644
--- a/src/serdi.c
+++ b/src/serdi.c
@@ -33,6 +33,7 @@
#include <errno.h>
#include <stdbool.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#define SERDI_ERROR(msg) fprintf(stderr, "serdi: " msg)
@@ -236,11 +237,15 @@ main(int argc, char** argv)
_setmode(_fileno(stdout), _O_BINARY);
#endif
- const char* input = (const char*)argv[a++];
+ char* input_path = NULL;
+ const char* input = (const char*)argv[a++];
if (from_file) {
in_name = in_name ? in_name : input;
if (!in_fd) {
- input = serd_uri_to_path(in_name);
+ if (!strncmp(input, "file:", 5)) {
+ input_path = serd_file_uri_parse(input, NULL);
+ input = input_path;
+ }
if (!input || !(in_fd = serd_fopen(input, "rb"))) {
return 1;
}
@@ -331,6 +336,7 @@ main(int argc, char** argv)
serd_writer_free(writer);
serd_env_free(env);
serd_node_free(base);
+ free(input_path);
if (from_file) {
fclose(in_fd);