From 059f20c9666234f2be01498ee04f1e7ee795ba8f Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 6 Mar 2010 10:23:19 +0000 Subject: Save Ingen patches as working standard LV2 plugin bundles. This allows you to create an Ingen patch in Ingen running as a Jack client, save it, then load that patch as an LV2 plugin in any LV2 compliant host. Eliminate (hopefully) all static data in the engine (for multiple instantiations in a single process). More API/ABI stable interface for Ingen::Shared::World. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2533 a436a847-0d15-0410-975c-d299462d15a1 --- src/shared/runtime_paths.cpp | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) (limited to 'src/shared/runtime_paths.cpp') diff --git a/src/shared/runtime_paths.cpp b/src/shared/runtime_paths.cpp index f823c4e2..832c3472 100644 --- a/src/shared/runtime_paths.cpp +++ b/src/shared/runtime_paths.cpp @@ -41,29 +41,44 @@ set_bundle_path_from_code(void* function) Dl_info dli; dladdr(function, &dli); +#ifdef BUNDLE char bin_loc[PATH_MAX]; realpath(dli.dli_fname, bin_loc); +#else + const char* bin_loc = dli.dli_fname; +#endif -#ifdef BUNDLE string bundle = bin_loc; bundle = bundle.substr(0, bundle.find_last_of(G_DIR_SEPARATOR)); bundle_path = bundle; -#endif } +void +set_bundle_path(const char* path) +{ + bundle_path = path; +} + + +/** Return the absolute path of a file in an Ingen LV2 bundle + */ +std::string +bundle_file_path(const std::string& name) +{ + return Glib::build_filename(bundle_path, name); +} + /** Return the absolute path of a 'resource' file. */ std::string data_file_path(const std::string& name) { - std::string ret; #ifdef BUNDLE - ret = Glib::build_filename(bundle_path, Glib::build_path(INGEN_DATA_DIR, name)); + return Glib::build_filename(bundle_path, Glib::build_path(INGEN_DATA_DIR, name)); #else - ret = Glib::build_filename(INGEN_DATA_DIR, name); + return Glib::build_filename(INGEN_DATA_DIR, name); #endif - return ret; } @@ -72,13 +87,11 @@ data_file_path(const std::string& name) std::string module_path(const std::string& name) { - std::string ret; #ifdef BUNDLE - ret = Glib::Module::build_path(Glib::build_path(bundle_path, INGEN_MODULE_DIR), name); + return Glib::Module::build_path(Glib::build_path(bundle_path, INGEN_MODULE_DIR), name); #else - ret = Glib::Module::build_path(INGEN_MODULE_DIR, name); + return Glib::Module::build_path(INGEN_MODULE_DIR, name); #endif - return ret; } -- cgit v1.2.1