diff options
-rw-r--r-- | src/engine/ingen.lv2/ingen_lv2.cpp | 2 | ||||
-rw-r--r-- | src/gui/App.cpp | 3 | ||||
-rw-r--r-- | src/gui/GladeFactory.cpp | 19 | ||||
-rw-r--r-- | src/gui/LoadPatchWindow.cpp | 4 | ||||
-rw-r--r-- | src/gui/LoadSubpatchWindow.cpp | 4 | ||||
-rw-r--r-- | src/ingen/main.cpp | 4 | ||||
-rw-r--r-- | src/module/Module.cpp | 3 | ||||
-rw-r--r-- | src/shared/wscript | 1 | ||||
-rw-r--r-- | wscript | 13 |
9 files changed, 33 insertions, 20 deletions
diff --git a/src/engine/ingen.lv2/ingen_lv2.cpp b/src/engine/ingen.lv2/ingen_lv2.cpp index 4c81c42b..67b63fc5 100644 --- a/src/engine/ingen.lv2/ingen_lv2.cpp +++ b/src/engine/ingen.lv2/ingen_lv2.cpp @@ -118,6 +118,8 @@ ingen_instantiate(const LV2_Descriptor* descriptor, { IngenPlugin* plugin = (IngenPlugin*)malloc(sizeof(IngenPlugin)); + Shared::bundle_path = bundle_path; + plugin->world = Ingen::Shared::get_world(); plugin->engine = SharedPtr<Engine>(new Engine(plugin->world)); plugin->world->local_engine = plugin->engine; diff --git a/src/gui/App.cpp b/src/gui/App.cpp index 7e414297..615ac36f 100644 --- a/src/gui/App.cpp +++ b/src/gui/App.cpp @@ -34,6 +34,7 @@ #include "client/PatchModel.hpp" #include "client/ClientStore.hpp" #include "engine/Engine.hpp" +#include "shared/runtime_paths.hpp" #include "NodeModule.hpp" #include "ControlPanel.hpp" #include "SubpatchModule.hpp" @@ -107,7 +108,7 @@ App::run(int argc, char** argv, Ingen::Shared::World* world) _instance->configuration()->apply_settings(); // Set default window icon - const Glib::ustring icon_path = INGEN_DATA_DIR "/ingen.svg"; + const Glib::ustring icon_path = Shared::data_file_path("ingen.svg"); try { if (Glib::file_test(icon_path, Glib::FILE_TEST_EXISTS)) Gtk::Window::set_default_icon_from_file(icon_path); diff --git a/src/gui/GladeFactory.cpp b/src/gui/GladeFactory.cpp index 81640d57..792e67ac 100644 --- a/src/gui/GladeFactory.cpp +++ b/src/gui/GladeFactory.cpp @@ -19,6 +19,7 @@ #include <iostream> #include <fstream> #include "config.h" +#include "shared/runtime_paths.hpp" using namespace std; @@ -36,21 +37,15 @@ GladeFactory::find_glade_file() if (env_path) glade_filename = env_path; else - glade_filename = "./ingen_gui.glade"; + glade_filename = Shared::data_file_path("ingen_gui.glade"); ifstream fs(glade_filename.c_str()); - if (fs.fail()) { // didn't find it, check INGEN_DATA_DIR - fs.clear(); - glade_filename = INGEN_DATA_DIR; - glade_filename += "/ingen_gui.glade"; - - fs.open(glade_filename.c_str()); - if (fs.fail()) { - cerr << "[GladeFactory] Unable to find ingen_gui.glade in current directory or " << INGEN_DATA_DIR << "." << endl; - throw; - } - fs.close(); + if (fs.fail()) { + cerr << "Unable to find ingen_gui.glade in " << INGEN_DATA_DIR << endl; + throw; } + + fs.close(); cerr << "[GladeFactory] Loading widgets from " << glade_filename.c_str() << endl; } diff --git a/src/gui/LoadPatchWindow.cpp b/src/gui/LoadPatchWindow.cpp index fdbc3c23..caa6c8bf 100644 --- a/src/gui/LoadPatchWindow.cpp +++ b/src/gui/LoadPatchWindow.cpp @@ -21,6 +21,7 @@ #include "LoadPatchWindow.hpp" #include "interface/EngineInterface.hpp" #include "client/PatchModel.hpp" +#include "shared/runtime_paths.hpp" #include "App.hpp" #include "Configuration.hpp" #include "ThreadedLoader.hpp" @@ -60,8 +61,7 @@ LoadPatchWindow::LoadPatchWindow(BaseObjectType* cobject, const Glib::RefPtr<Gno set_filter(filt); // Add global examples directory to "shortcut folders" (bookmarks) - string examples_dir = INGEN_DATA_DIR; - examples_dir.append("/patches"); + const string examples_dir = Shared::data_file_path("patches"); DIR* d = opendir(examples_dir.c_str()); if (d != NULL) add_shortcut_folder(examples_dir); diff --git a/src/gui/LoadSubpatchWindow.cpp b/src/gui/LoadSubpatchWindow.cpp index 71dbfb36..5bdd8ea6 100644 --- a/src/gui/LoadSubpatchWindow.cpp +++ b/src/gui/LoadSubpatchWindow.cpp @@ -22,6 +22,7 @@ #include "interface/EngineInterface.hpp" #include "client/NodeModel.hpp" #include "client/PatchModel.hpp" +#include "shared/runtime_paths.hpp" #include "App.hpp" #include "LoadSubpatchWindow.hpp" #include "PatchView.hpp" @@ -65,8 +66,7 @@ LoadSubpatchWindow::LoadSubpatchWindow(BaseObjectType* cobject, const Glib::RefP property_select_multiple() = true; // Add global examples directory to "shortcut folders" (bookmarks) - string examples_dir = INGEN_DATA_DIR; - examples_dir.append("/patches"); + const string examples_dir = Shared::data_file_path("patches"); DIR* d = opendir(examples_dir.c_str()); if (d != NULL) add_shortcut_folder(examples_dir); diff --git a/src/ingen/main.cpp b/src/ingen/main.cpp index 2f729ab9..8d155c5c 100644 --- a/src/ingen/main.cpp +++ b/src/ingen/main.cpp @@ -28,6 +28,7 @@ #include "raul/Path.hpp" #include "raul/SharedPtr.hpp" #include "redlandmm/World.hpp" +#include "shared/runtime_paths.hpp" #include "module/global.hpp" #include "module/Module.hpp" #include "module/World.hpp" @@ -86,6 +87,9 @@ main(int argc, char** argv) return 1; } + /* Set bundle path from executable location so resources/modules can be found */ + Shared::set_bundle_path_from_code((void*)&main); + SharedPtr<Glib::Module> engine_module; SharedPtr<Glib::Module> engine_http_module; SharedPtr<Glib::Module> engine_osc_module; diff --git a/src/module/Module.cpp b/src/module/Module.cpp index 2f143443..a42e466b 100644 --- a/src/module/Module.cpp +++ b/src/module/Module.cpp @@ -22,6 +22,7 @@ #include <glibmm/miscutils.h> #include <glibmm/fileutils.h> #include "raul/SharedPtr.hpp" +#include "shared/runtime_paths.hpp" #include "config.h" using namespace std; @@ -66,7 +67,7 @@ load_module(const string& name) // Try default directory if not found module = new Glib::Module( - Glib::Module::build_path(INGEN_MODULE_DIR, name), + Shared::module_path(name), Glib::MODULE_BIND_LAZY); if (*module) { diff --git a/src/shared/wscript b/src/shared/wscript index d7512559..6a5758a0 100644 --- a/src/shared/wscript +++ b/src/shared/wscript @@ -10,6 +10,7 @@ def build(bld): LV2Features.cpp LV2URIMap.cpp Store.cpp + runtime_paths.cpp ''' if bld.env()['HAVE_LIBLO']: obj.source += ' OSCSender.cpp ' @@ -53,8 +53,17 @@ def configure(conf): conf.define('INGEN_VERSION', INGEN_VERSION) conf.define('BUILD_GUI', build_gui) conf.define('HAVE_JACK_MIDI', conf.env['HAVE_JACK'] == 1) - conf.define('INGEN_DATA_DIR', os.path.normpath(conf.env['DATADIR'] + 'ingen')) - conf.define('INGEN_MODULE_DIR', os.path.normpath(conf.env['LIBDIR'] + 'ingen')) + if conf.env['BUNDLE']: + conf.define('INGEN_DATA_DIR', os.path.normpath( + conf.env['DATADIRNAME'] + 'ingen')) + conf.define('INGEN_MODULE_DIR', os.path.normpath( + conf.env['LIBDIRNAME'] + 'ingen')) + else: + conf.define('INGEN_DATA_DIR', os.path.normpath( + conf.env['DATADIR'] + 'ingen')) + conf.define('INGEN_MODULE_DIR', os.path.normpath( + conf.env['LIBDIR'] + 'ingen')) + conf.write_config_header('config.h') autowaf.print_summary(conf) |