summaryrefslogtreecommitdiffstats
path: root/src/libs
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-08-18 21:44:54 +0000
committerDavid Robillard <d@drobilla.net>2008-08-18 21:44:54 +0000
commite001689a6b3692cf7a73b8f5d3f664d560097e13 (patch)
tree54bebca214dd5ffb67837cf19a20e4768d1ff9d1 /src/libs
parent1631460b986285cdeb58462836f8a825ac1c7975 (diff)
downloadingen-e001689a6b3692cf7a73b8f5d3f664d560097e13.tar.gz
ingen-e001689a6b3692cf7a73b8f5d3f664d560097e13.tar.bz2
ingen-e001689a6b3692cf7a73b8f5d3f664d560097e13.zip
Fix loading patches and importing patches inside nested patches.
git-svn-id: http://svn.drobilla.net/lad/ingen@1436 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs')
-rw-r--r--src/libs/engine/events/CreatePatchEvent.cpp5
-rw-r--r--src/libs/serialisation/Parser.cpp27
2 files changed, 21 insertions, 11 deletions
diff --git a/src/libs/engine/events/CreatePatchEvent.cpp b/src/libs/engine/events/CreatePatchEvent.cpp
index 6279732e..64fe5c63 100644
--- a/src/libs/engine/events/CreatePatchEvent.cpp
+++ b/src/libs/engine/events/CreatePatchEvent.cpp
@@ -134,9 +134,10 @@ CreatePatchEvent::post_process()
msg.append(_path);
_responder->respond_error(msg);
} else if (_error == OBJECT_EXISTS) {
- string msg = "Unable to create patch: ";
+ _responder->respond_ok();
+ /*string msg = "Unable to create patch: ";
msg.append(_path).append(" already exists.");
- _responder->respond_error(msg);
+ _responder->respond_error(msg);*/
} else if (_error == PARENT_NOT_FOUND) {
string msg = "Unable to create patch: Parent ";
msg.append(Path(_path).parent()).append(" not found.");
diff --git a/src/libs/serialisation/Parser.cpp b/src/libs/serialisation/Parser.cpp
index 4fc7b6a9..2817766e 100644
--- a/src/libs/serialisation/Parser.cpp
+++ b/src/libs/serialisation/Parser.cpp
@@ -164,7 +164,8 @@ Parser::parse(
continue;
if (rdf_class == patch_class) {
- ret = parse_patch(world, target, model, base_uri, subject.to_c_string(), engine_base.get(), data);
+ ret = parse_patch(world, target, model, base_uri, subject.to_c_string(),
+ engine_base.get(), data);
if (ret)
target->set_variable(path, "ingen:document", Atom(base_uri.c_str()));
} else if (rdf_class == node_class) {
@@ -205,10 +206,13 @@ Parser::parse_patch(
if (poly_param != data.get().end() && poly_param->second.type() == Atom::INT)
patch_poly = poly_param->second.get_int32();
}
-
+
const Glib::ustring subject = ((object_uri[0] == '<')
? object_uri : Glib::ustring("<") + object_uri + ">");
+ //cout << "**** LOADING PATCH URI " << object_uri << ", SUBJ " << subject
+ // << ", ENG BASE " << engine_base << endl;
+
/* Get polyphony from file (mandatory if not specified in parameters) */
if (patch_poly == 0) {
Redland::Query query(*world->rdf_world, Glib::ustring(
@@ -236,9 +240,9 @@ Parser::parse_patch(
else
patch_path = (Path)engine_base;
- if (patch_path != engine_base && patch_path != "/")
+ if (patch_path != "/")
target->new_patch(patch_path, patch_poly);
-
+
/* Plugin nodes */
Redland::Query query(*world->rdf_world, Glib::ustring(
"SELECT DISTINCT ?name ?plugin ?varkey ?varval ?poly WHERE {\n") +
@@ -282,22 +286,27 @@ Parser::parse_patch(
/* Load subpatches */
query = Redland::Query(*world->rdf_world, Glib::ustring(
- "SELECT DISTINCT ?patch ?symbol WHERE {\n") +
- subject + " ingen:node ?patch .\n"
- "?patch a ingen:Patch ;\n"
+ "SELECT DISTINCT ?subpatch ?symbol WHERE {\n") +
+ subject + " ingen:node ?subpatch .\n"
+ "?subpatch a ingen:Patch ;\n"
" ingen:symbol ?symbol .\n"
"}");
results = query.run(*world->rdf_world, model, base_uri);
for (Redland::Query::Results::iterator i = results.begin(); i != results.end(); ++i) {
const string symbol = (*i)["symbol"].to_string();
- const string patch = (*i)["patch"].to_string();
+ const string subpatch = (*i)["subpatch"].to_string();
const Path subpatch_path = patch_path.base() + symbol;
if (created.find(subpatch_path) == created.end()) {
+ string subpatch_rel = uri_relative_to_base(base_uri, subpatch);
+ string sub_base = engine_base;
+ if (sub_base[sub_base.length()-1] == '/')
+ sub_base = sub_base.substr(sub_base.length()-1);
+ sub_base.append("/").append(symbol);
created.insert(subpatch_path);
- parse_patch(world, target, model, base_uri, Glib::ustring(object_uri + subpatch_path), subpatch_path);
+ parse_patch(world, target, model, base_uri, subpatch_rel, sub_base);
}
}