diff options
author | David Robillard <d@drobilla.net> | 2007-05-04 05:30:14 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-05-04 05:30:14 +0000 |
commit | 515a22e7f1175dfcc89657f805557348a93b3682 (patch) | |
tree | d20183e6029f7fad3a75ec97aac6dcdd7a976777 /src/progs | |
parent | 465e1ecf8297b54b04c46610ccd48ee0ce866a87 (diff) | |
download | ingen-515a22e7f1175dfcc89657f805557348a93b3682.tar.gz ingen-515a22e7f1175dfcc89657f805557348a93b3682.tar.bz2 ingen-515a22e7f1175dfcc89657f805557348a93b3682.zip |
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
Diffstat (limited to 'src/progs')
-rw-r--r-- | src/progs/Makefile.am | 9 | ||||
-rw-r--r-- | src/progs/ingen/main.cpp | 23 |
2 files changed, 18 insertions, 14 deletions
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 <iostream> #include <string> #include <signal.h> +#include <glibmm/convert.h> +#include <glibmm/miscutils.h> #include <boost/optional.hpp> #include <raul/Path.h> #include <raul/RDFWorld.h> @@ -63,8 +65,10 @@ main(int argc, char** argv) } SharedPtr<Glib::Module> engine_module; + SharedPtr<Glib::Module> client_module; SharedPtr<Glib::Module> gui_module; + SharedPtr<Shared::EngineInterface> 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<Glib::Module> client_module - = Ingen::Shared::load_module("ingen_client"); + client_module = Ingen::Shared::load_module("ingen_client"); SharedPtr<Shared::EngineInterface> (*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<Serialisation::Loader> 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; |