From 515a22e7f1175dfcc89657f805557348a93b3682 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 4 May 2007 05:30:14 +0000 Subject: Patch loading from the command line with absolute paths, relative paths, or local/remote URIs. git-svn-id: http://svn.drobilla.net/lad/ingen@497 a436a847-0d15-0410-975c-d299462d15a1 --- src/progs/Makefile.am | 9 --------- src/progs/ingen/main.cpp | 23 ++++++++++++++++++----- 2 files changed, 18 insertions(+), 14 deletions(-) (limited to 'src/progs') diff --git a/src/progs/Makefile.am b/src/progs/Makefile.am index f2e1e8ef..836c924a 100644 --- a/src/progs/Makefile.am +++ b/src/progs/Makefile.am @@ -4,12 +4,3 @@ DIST_SUBDIRS = python supercollider demolition SUBDIRS = ingen -if BUILD_CONSOLE_CLIENTS -SUBDIRS += patch_loader # demolition -endif - -#if BUILD_GTK_CLIENT -#SUBDIRS += ingenuity -#endif - - diff --git a/src/progs/ingen/main.cpp b/src/progs/ingen/main.cpp index 1ca1311a..57b8bf5c 100644 --- a/src/progs/ingen/main.cpp +++ b/src/progs/ingen/main.cpp @@ -18,6 +18,8 @@ #include #include #include +#include +#include #include #include #include @@ -63,8 +65,10 @@ main(int argc, char** argv) } SharedPtr engine_module; + SharedPtr client_module; SharedPtr gui_module; + SharedPtr engine_interface; /* Run engine */ @@ -104,8 +108,7 @@ main(int argc, char** argv) /* Connect to remote engine */ if (args.connect_given || (args.load_given && !engine_interface)) { bool found = false; - SharedPtr client_module - = Ingen::Shared::load_module("ingen_client"); + client_module = Ingen::Shared::load_module("ingen_client"); SharedPtr (*new_osc_interface)(const std::string&) = NULL; @@ -122,7 +125,7 @@ main(int argc, char** argv) /* Load a patch */ - if (args.load_given) { + if (args.load_given && engine_interface) { Raul::RDF::World rdf_world; rdf_world.add_prefix("xsd", "http://www.w3.org/2001/XMLSchema#"); @@ -147,8 +150,18 @@ main(int argc, char** argv) if (serialisation_module && found) { SharedPtr loader(new_loader()); - loader->load(engine_interface, &rdf_world, - string("file:") + args.load_arg, parent_path, ""); + + // Assumption: Containing ':' means URI, otherwise filename + string uri = args.load_arg; + if (uri.find(':') == string::npos) + if (Glib::path_is_absolute(args.load_arg)) + uri = Glib::filename_to_uri(args.load_arg); + else + uri = Glib::filename_to_uri(Glib::build_filename( + Glib::get_current_dir(), args.load_arg)); + + loader->load(engine_interface, &rdf_world, uri, parent_path, ""); + } else { cerr << "Unable to load serialisation module, aborting." << endl; return -1; -- cgit v1.2.1