diff options
-rw-r--r-- | NEWS | 7 | ||||
-rw-r--r-- | lilv/lilv.h | 13 | ||||
-rw-r--r-- | src/node.c | 14 | ||||
-rw-r--r-- | test/lilv_test.c | 10 | ||||
-rw-r--r-- | utils/lv2info.c | 22 | ||||
-rw-r--r-- | wscript | 2 |
6 files changed, 58 insertions, 10 deletions
@@ -1,4 +1,4 @@ -lilv (0.18.1) unstable; +lilv (0.19.0) unstable; * Don't load files multiple times if they are listed as rdfs:seeAlso for several plugins @@ -6,8 +6,11 @@ lilv (0.18.1) unstable; * Call lv2_lib_descriptor separately for different bundle paths (fix loading several dynamic plugins like Ingen at once) * Tolerate calling lilv_node_as_uri or lilv_node_as_blank on NULL + * Add convenient lilv_new_file_uri for creating file URIs. + * Fix use of lv2info -m and -p options to write plugin data + (useful for porting plugins bridges with NASPRO). - -- David Robillard <d@drobilla.net> Sat, 26 Apr 2014 20:29:27 -0400 + -- David Robillard <d@drobilla.net> Mon, 05 May 2014 17:00:36 +0200 lilv (0.18.0) stable; diff --git a/lilv/lilv.h b/lilv/lilv.h index bdf70dc..8c60132 100644 --- a/lilv/lilv.h +++ b/lilv/lilv.h @@ -119,6 +119,19 @@ LilvNode* lilv_new_uri(LilvWorld* world, const char* uri); /** + Create a new file URI value. + @param host Host name, or NULL. + @param path Path on host. + @return A new node that must be freed by caller. + + Relative paths are resolved against the current working directory. Note + that this may yield unexpected results if @p host is another machine. +*/ +LILV_API +LilvNode* +lilv_new_file_uri(LilvWorld* world, const char* host, const char* path); + +/** Create a new string value (with no language). Returned value must be freed by caller with lilv_node_free. */ @@ -156,6 +156,20 @@ lilv_new_uri(LilvWorld* world, const char* uri) LILV_API LilvNode* +lilv_new_file_uri(LilvWorld* world, const char* host, const char* path) +{ + char* abs_path = lilv_path_absolute(path); + SerdNode s = serd_node_new_file_uri( + (const uint8_t*)abs_path, (const uint8_t*)host, NULL, true); + + LilvNode* ret = lilv_node_new(world, LILV_VALUE_URI, (const char*)s.buf); + serd_node_free(&s); + free(abs_path); + return ret; +} + +LILV_API +LilvNode* lilv_new_string(LilvWorld* world, const char* str) { return lilv_node_new(world, LILV_VALUE_STRING, str); diff --git a/test/lilv_test.c b/test/lilv_test.c index 998ffb0..102ffc6 100644 --- a/test/lilv_test.c +++ b/test/lilv_test.c @@ -259,6 +259,16 @@ test_value(void) TEST_ASSERT(lilv_node_as_int(ival) == 42); TEST_ASSERT(fabs(lilv_node_as_float(fval) - 1.6180) < FLT_EPSILON); + LilvNode* loc_abs = lilv_new_file_uri(world, NULL, "/foo/bar"); + LilvNode* loc_rel = lilv_new_file_uri(world, NULL, "foo"); + LilvNode* host_abs = lilv_new_file_uri(world, "host", "/foo/bar"); + LilvNode* host_rel = lilv_new_file_uri(world, "host", "foo"); + + TEST_ASSERT(!strcmp(lilv_node_as_uri(loc_abs), "file:///foo/bar")); + TEST_ASSERT(!strncmp(lilv_node_as_uri(loc_rel), "file:///", 8)); + TEST_ASSERT(!strcmp(lilv_node_as_uri(host_abs), "file://host/foo/bar")); + TEST_ASSERT(!strncmp(lilv_node_as_uri(host_rel), "file://host/", 12)); + char* tok = lilv_node_get_turtle_token(uval); TEST_ASSERT(!strcmp(tok, "<http://example.org>")); free(tok); diff --git a/utils/lv2info.c b/utils/lv2info.c index d20789e..3bd79f4 100644 --- a/utils/lv2info.c +++ b/utils/lv2info.c @@ -1,5 +1,5 @@ /* - Copyright 2007-2011 David Robillard <http://drobilla.net> + Copyright 2007-2014 David Robillard <http://drobilla.net> Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above @@ -399,17 +399,25 @@ main(int argc, char** argv) const LilvPlugin* p = lilv_plugins_get_by_uri(plugins, uri); if (p && plugin_file) { - LilvNode* base = lilv_new_uri(world, plugin_file); + LilvNode* base = lilv_new_file_uri(world, NULL, plugin_file); FILE* plugin_fd = fopen(plugin_file, "a"); - lilv_plugin_write_description(world, p, base, plugin_fd); - fclose(plugin_fd); + if (plugin_fd) { + lilv_plugin_write_description(world, p, base, plugin_fd); + fclose(plugin_fd); + } else { + fprintf(stderr, "error: Failed to open %s\n", plugin_file); + } if (manifest_file) { FILE* manifest_fd = fopen(manifest_file, "a"); - lilv_plugin_write_manifest_entry( - world, p, base, manifest_fd, plugin_file); - fclose(manifest_fd); + if (manifest_fd) { + lilv_plugin_write_manifest_entry( + world, p, base, manifest_fd, plugin_file); + fclose(manifest_fd); + } else { + fprintf(stderr, "error: Failed to open %s\n", manifest_file); + } } lilv_node_free(base); } else if (p) { @@ -12,7 +12,7 @@ import waflib.Logs as Logs # major increment <=> incompatible changes # minor increment <=> compatible changes (additions) # micro increment <=> no interface changes -LILV_VERSION = '0.18.1' +LILV_VERSION = '0.19.0' LILV_MAJOR_VERSION = '0' # Mandatory waf variables |