From e5c8e0d9752cfa6de4e6e0e8314ac572a9d113b1 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 13 Dec 2006 07:09:22 +0000 Subject: Path parent/child bug fixes, added unit tests. Breadcrumb/browsing/subsubpatch bug fixes. Fixed about window icon and glade error messages. git-svn-id: http://svn.drobilla.net/lad/ingen@223 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/client/Loader.cpp | 28 +++++++++++++++------------- src/libs/client/Loader.h | 1 + 2 files changed, 16 insertions(+), 13 deletions(-) (limited to 'src/libs/client') diff --git a/src/libs/client/Loader.cpp b/src/libs/client/Loader.cpp index 68b04b58..af51d4c8 100644 --- a/src/libs/client/Loader.cpp +++ b/src/libs/client/Loader.cpp @@ -46,6 +46,7 @@ Loader::Loader(SharedPtr engine, SharedPtr nam bool Loader::load(const Glib::ustring& filename, const Path& parent, + string patch_name, Glib::ustring patch_uri, MetadataMap data) { @@ -82,23 +83,24 @@ Loader::load(const Glib::ustring& filename, size_t patch_poly = atoi(((*results.begin())["poly"]).c_str()); - /* Get name (if available) */ + /* Get name (if available/necessary) */ - query = RDFQuery(Glib::ustring( - "SELECT DISTINCT ?name \nFROM <") + document_uri + ">\nWHERE {\n\t" + - patch_uri + " ingen:name ?name .\n" - "}"); + if (patch_name == "") { + patch_name = string(filename.substr(filename.find_last_of("/")+1)); + + query = RDFQuery(Glib::ustring( + "SELECT DISTINCT ?name FROM <") + document_uri + "> WHERE {\n" + + patch_uri + " ingen:name ?name .\n" + "}"); - results = query.run(document_uri); - - string patch_name = string(filename.substr(filename.find_last_of("/")+1)); - Path patch_path = parent.base() + string(filename.substr(filename.find_last_of("/")+1)); + results = query.run(document_uri); - if (results.size() > 0) - patch_path = parent.base() + string((*results.begin())["name"]); - - cerr << "************ PATCH: " << patch_path << ", poly = " << patch_poly << endl; + if (results.size() > 0) + patch_name = string((*results.begin())["name"]); + } + Path patch_path = parent.base() + patch_name; + cerr << "************ PATCH: " << patch_path << ", poly = " << patch_poly << endl; _engine->create_patch(patch_path, patch_poly); diff --git a/src/libs/client/Loader.h b/src/libs/client/Loader.h index 86317c1f..bca385aa 100644 --- a/src/libs/client/Loader.h +++ b/src/libs/client/Loader.h @@ -37,6 +37,7 @@ public: bool load(const Glib::ustring& filename, const Path& parent, + string patch_name, Glib::ustring patch_uri = "", MetadataMap initial_data = MetadataMap()); -- cgit v1.2.1