summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-10-04 01:55:16 +0000
committerDavid Robillard <d@drobilla.net>2007-10-04 01:55:16 +0000
commitc3631e70c70086539dd271322c413096417a0c1c (patch)
treed7975fa808cc655481b056d652198c289e9e7dcf /src
parentc1b50ad1aabd55702c0b20392dc9ad40813ca976 (diff)
downloadlilv-c3631e70c70086539dd271322c413096417a0c1c.tar.gz
lilv-c3631e70c70086539dd271322c413096417a0c1c.tar.bz2
lilv-c3631e70c70086539dd271322c413096417a0c1c.zip
Stripped some old useless #if 0'd out code.
Switch back to looking in ~/.lv2 for user bundles 'cause larsl said so. git-svn-id: http://svn.drobilla.net/lad/slv2@822 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/plugins.c206
-rw-r--r--src/world.c2
2 files changed, 2 insertions, 206 deletions
diff --git a/src/plugins.c b/src/plugins.c
index d3b7bde..ac8b863 100644
--- a/src/plugins.c
+++ b/src/plugins.c
@@ -58,213 +58,9 @@ slv2_plugins_filter(SLV2Plugins dest, SLV2Plugins source, bool (*include)(SLV2Pl
raptor_sequence_push(dest, slv2_plugin_duplicate(p));
}
}
-
-
-void
-slv2_plugins_load_all(SLV2Plugins list)
-{
- /* FIXME: this is much slower than it should be in many ways.. */
-
- assert(list);
-
- char* slv2_path = getenv("LV2_PATH");
-
- SLV2Plugins load_list = slv2_plugins_new();
-
- if (slv2_path) {
- slv2_plugins_load_path(load_list, slv2_path);
- } else {
- const char* const home = getenv("HOME");
- const char* const suffix = "/.lv2:/usr/local/lib/lv2:usr/lib/lv2";
- slv2_path = slv2_strjoin(home, suffix, NULL);
-
- fprintf(stderr, "$LV2_PATH is unset. Using default path %s\n", slv2_path);
-
- /* pass 1: find all plugins */
- slv2_plugins_load_path(load_list, slv2_path);
-
- /* pass 2: find all data files for plugins */
- slv2_plugins_load_path(load_list, slv2_path);
-
- free(slv2_path);
- }
-
- /* insert only valid plugins into list */
- slv2_plugins_filter(list, load_list, slv2_plugin_verify);
- slv2_plugins_free(load_list);
-}
-
-
-/* This is the parser for manifest.ttl
- * This is called twice on each bundle in the discovery process, which is (much) less
- * efficient than it could be.... */
-void
-slv2_plugins_load_bundle(SLV2Plugins list,
- const char* bundle_base_url)
-{
- assert(list);
-
- unsigned char* manifest_url = malloc(
- (strlen((char*)bundle_base_url) + strlen("manifest.ttl") + 2) * sizeof(unsigned char));
- memcpy(manifest_url, bundle_base_url, strlen((char*)bundle_base_url)+1 * sizeof(unsigned char));
- if (bundle_base_url[strlen(bundle_base_url)-1] == '/')
- strcat((char*)manifest_url, "manifest.ttl");
- else
- strcat((char*)manifest_url, "/manifest.ttl");
-
- librdf_query_results *results;
- librdf_uri *base_uri = librdf_new_uri(slv2_rdf_world, manifest_url);
-
- /* Get all plugins explicitly mentioned in the manifest (discovery pass 1) */
- char* query_string =
- "PREFIX : <http://lv2plug.in/ns/lv2core#>\n\n"
- "SELECT DISTINCT ?plugin_uri FROM <>\n"
- "WHERE { ?plugin_uri a :Plugin }\n";
-
- librdf_query *rq = librdf_new_query(slv2_rdf_world, "sparql", NULL,
- (unsigned char*)query_string, base_uri);
-
-
-
- //printf("%s\n\n", query_string);
-
- results = librdf_query_execute(rq, model->model);
-
- while (!librdf_query_results_finished(results)) {
-
- librdf_node* literal = librdf_query_results_get_binding_value(results, 0);
- assert(literal);
-
- if (!slv2_plugins_get_by_uri(list, (const char*)librdf_node_get_literal_value(literal))) {
- /* Create a new plugin */
- struct _Plugin* new_plugin = slv2_plugin_new();
- new_plugin->plugin_uri = strdup((const char*)librdf_node_get_literal_value(literal));
- new_plugin->bundle_url = strdup(bundle_base_url);
- raptor_sequence_push(new_plugin->data_uris, strdup((const char*)manifest_url));
-
- raptor_sequence_push(list, new_plugin);
-
- }
-
- librdf_query_results_next(results);
- }
-
- if (results)
- librdf_free_query_results(results);
-
- librdf_free_query(rq);
-
- /* Get all data files linked to plugins (discovery pass 2) */
- query_string =
- "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n"
- "PREFIX : <http://lv2plug.in/ns/lv2core#>\n\n"
- "SELECT DISTINCT ?subject ?data_uri ?binary FROM <>\n"
- "WHERE { ?subject rdfs:seeAlso ?data_uri\n"
- "OPTIONAL { ?subject :binary ?binary } }\n";
-
- rq = librdf_new_query(slv2_rdf_world, "sparql", NULL,
- (unsigned char*)query_string, base_uri);
-
- //printf("%s\n\n", query_string);
-
- results = librdf_query_execute(rq, slv2_model);
-
- while (!librdf_query_results_finished(results)) {
-
- const char* subject = (const char*)librdf_node_get_literal_value(
- librdf_query_results_get_binding_value(results, 0));
-
- const char* data_uri = (const char*)librdf_node_get_literal_value(
- librdf_query_results_get_binding_value(results, 1));
-
- const char* binary = (const char*)librdf_node_get_literal_value(
- librdf_query_results_get_binding_value(results, 2));
-
- SLV2Plugin plugin = slv2_plugins_get_by_uri(list, subject);
-
- if (plugin && data_uri && !slv2_values_contains(plugin->data_uris, data_uri))
- raptor_sequence_push(plugin->data_uris, strdup(data_uri));
-
- if (plugin && binary && !plugin->lib_uri)
- ((struct _Plugin*)plugin)->lib_uri = strdup(binary);
-
- librdf_query_results_next(results);
-
- }
-
- if (results)
- librdf_free_query_results(results);
-
- librdf_free_query(rq);
-
- librdf_free_uri(base_uri);
- free(manifest_url);
-}
-
-
-/* Add all the plugins found in dir to list.
- * (Private helper function, not exposed in public API)
- */
-void
-slv2_plugins_load_dir(SLV2Plugins list, const char* dir)
-{
- assert(list);
-
- DIR* pdir = opendir(dir);
- if (!pdir)
- return;
-
- struct dirent* pfile;
- while ((pfile = readdir(pdir))) {
- if (!strcmp(pfile->d_name, ".") || !strcmp(pfile->d_name, ".."))
- continue;
-
- char* bundle_path = slv2_strjoin(dir, "/", pfile->d_name, NULL);
- char* bundle_url = slv2_strjoin("file://", dir, "/", pfile->d_name, NULL);
- DIR* bundle_dir = opendir(bundle_path);
-
- if (bundle_dir != NULL) {
- closedir(bundle_dir);
-
- slv2_plugins_load_bundle(list, bundle_url);
- //printf("Loaded bundle %s\n", bundle_url);
- }
-
- free(bundle_path);
- free(bundle_url);
- }
-
- closedir(pdir);
-}
-
-
-void
-slv2_plugins_load_path(SLV2Plugins list,
- const char* lv2_path)
-{
- assert(list);
-
- char* path = slv2_strjoin(lv2_path, ":", NULL);
- char* dir = path; // Pointer into path
-
- // Go through string replacing ':' with '\0', using the substring,
- // then replacing it with 'X' and moving on. i.e. strtok on crack.
- while (strchr(path, ':') != NULL) {
- char* delim = strchr(path, ':');
- *delim = '\0';
-
- slv2_plugins_load_dir(list, dir);
-
- *delim = 'X';
- dir = delim + 1;
- }
-
- //char* slv2_path = strdup(slv2
-
- free(path);
-}
#endif
+
unsigned
slv2_plugins_size(SLV2Plugins list)
{
diff --git a/src/world.c b/src/world.c
index 4b832b7..e19d359 100644
--- a/src/world.c
+++ b/src/world.c
@@ -448,7 +448,7 @@ slv2_world_load_all(SLV2World world)
} else {
const char* const home = getenv("HOME");
if (home) {
- const char* const suffix = "/.lv2/bundles:/usr/local/lib/lv2:/usr/lib/lv2";
+ const char* const suffix = "/.lv2:/usr/local/lib/lv2:/usr/lib/lv2";
lv2_path = slv2_strjoin(home, suffix, NULL);
} else {
lv2_path = strdup("/usr/local/lib/lv2:/usr/lib/lv2");