summaryrefslogtreecommitdiffstats
path: root/src/serialisation/Parser.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-11-27 03:15:57 +0000
committerDavid Robillard <d@drobilla.net>2008-11-27 03:15:57 +0000
commitc28fe36d38ce83e1c8421e2db75d9d41909a6acf (patch)
treefc6fa63a3b43b858acc6083144fd88a51881562f /src/serialisation/Parser.cpp
parentdf9fc0187cb4c472190866fe352d42a415464a6b (diff)
downloadingen-c28fe36d38ce83e1c8421e2db75d9d41909a6acf.tar.gz
ingen-c28fe36d38ce83e1c8421e2db75d9d41909a6acf.tar.bz2
ingen-c28fe36d38ce83e1c8421e2db75d9d41909a6acf.zip
Remember document name (so File->Save doesn't prompt).
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@1786 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/serialisation/Parser.cpp')
-rw-r--r--src/serialisation/Parser.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/serialisation/Parser.cpp b/src/serialisation/Parser.cpp
index f4e1f40c..408a3c7d 100644
--- a/src/serialisation/Parser.cpp
+++ b/src/serialisation/Parser.cpp
@@ -88,7 +88,17 @@ Parser::parse_document(
if (symbol)
cout << "[Parser] Symbol: " << symbol.get() << endl;
- return parse(world, target, model, document_uri, engine_base, object_uri, symbol, data);;
+ bool ret = parse(world, target, model, document_uri, engine_base, object_uri, symbol, data);
+
+ const string object_path = (document_uri == object_uri) ? "/"
+ : uri_relative_to_base(document_uri, object_uri);
+
+ if (Path::is_valid(object_path))
+ target->set_variable(object_path, "ingen:document", Atom(document_uri.c_str()));
+ else
+ cerr << "WARNING: " << object_path << " is not a valid path, document URI lost" << endl;
+
+ return ret;
}
@@ -269,8 +279,6 @@ Parser::parse(
if (rdf_class == patch_class) {
ret = parse_patch(world, target, model, base_uri, engine_base, path_str, data);
- //if (ret)
- // target->set_variable(path, "ingen:document", Atom(base_uri.c_str()));
} else if (rdf_class == node_class) {
ret = parse_node(world, target, model,
base_uri, Glib::ustring("<") + subject.to_c_string() + ">", path, data);