summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-03-28 01:37:37 +0000
committerDavid Robillard <d@drobilla.net>2011-03-28 01:37:37 +0000
commit58370cddf816d71354befd5bc1f90ca3671de380 (patch)
tree193d8feac5f5fc8e188cf7da5e32d98034fb29ac
parentd3793a40f3a66d1ee2226d27024152456ebde07b (diff)
downloadsord-58370cddf816d71354befd5bc1f90ca3671de380.tar.gz
sord-58370cddf816d71354befd5bc1f90ca3671de380.tar.bz2
sord-58370cddf816d71354befd5bc1f90ca3671de380.zip
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
-rw-r--r--src/syntax.c9
1 files changed, 8 insertions, 1 deletions
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;
}