summaryrefslogtreecommitdiffstats
path: root/src/shared/runtime_paths.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2010-03-06 10:23:19 +0000
committerDavid Robillard <d@drobilla.net>2010-03-06 10:23:19 +0000
commit059f20c9666234f2be01498ee04f1e7ee795ba8f (patch)
treeef0d53073d53012aeaa7d084fccf477b166c0684 /src/shared/runtime_paths.cpp
parent085a451dfec54126be1b9346899c81d82e6eb58e (diff)
downloadingen-059f20c9666234f2be01498ee04f1e7ee795ba8f.tar.gz
ingen-059f20c9666234f2be01498ee04f1e7ee795ba8f.tar.bz2
ingen-059f20c9666234f2be01498ee04f1e7ee795ba8f.zip
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
Diffstat (limited to 'src/shared/runtime_paths.cpp')
-rw-r--r--src/shared/runtime_paths.cpp33
1 files changed, 23 insertions, 10 deletions
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;
}