From 58370cddf816d71354befd5bc1f90ca3671de380 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 28 Mar 2011 01:37:37 +0000 Subject: Fix sord_file_uri_to_path on Windows. Print error messages on various parsing failures. git-svn-id: http://svn.drobilla.net/sord/trunk@72 3d64ff67-21c5-427c-a301-fe4f08042e5a --- src/syntax.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/syntax.c b/src/syntax.c index 0425485..e2a2df2 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -188,8 +188,13 @@ sord_file_uri_to_path(const uint8_t* uri) if (strncmp((const char*)uri, "file:", 5)) { fprintf(stderr, "unsupported URI scheme `%s'\n", uri); return NULL; +#ifdef __WIN32__ + } else if (!strncmp((const char*)uri, "file:///", 8)) { + filename = uri + 8; +#else } else if (!strncmp((const char*)uri, "file://", 7)) { filename = uri + 7; +#endif } else { filename = uri + 5; } @@ -208,11 +213,13 @@ sord_read_file(SordModel model, { const uint8_t* const path = sord_file_uri_to_path(uri); if (!path) { + fprintf(stderr, "unable to read non-file URI `%s'\n", uri); return false; } - FILE* const fd = fopen((const char*)path, "r"); + FILE* const fd = fopen((const char*)path, "r"); if (!fd) { + fprintf(stderr, "failed to open file `%s'\n", path); return false; } -- cgit v1.2.1