diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/module/World.cpp | 8 | ||||
-rw-r--r-- | src/shared/runtime_paths.cpp | 11 | ||||
-rw-r--r-- | src/shared/runtime_paths.hpp | 2 |
3 files changed, 12 insertions, 9 deletions
diff --git a/src/module/World.cpp b/src/module/World.cpp index 204cbdfa..43850b1a 100644 --- a/src/module/World.cpp +++ b/src/module/World.cpp @@ -58,7 +58,7 @@ load_module(const string& name) string dir; istringstream iss(module_path); while (getline(iss, dir, ':')) { - string filename = Glib::Module::build_path(dir, name); + string filename = Shared::module_path(name, dir); if (Glib::file_test(filename, Glib::FILE_TEST_EXISTS)) { module = new Glib::Module(filename, Glib::MODULE_BIND_LAZY); if (*module) { @@ -73,10 +73,8 @@ load_module(const string& name) } // Try default directory if not found - module = new Glib::Module( - Shared::module_path(name), - Glib::MODULE_BIND_LAZY); - + module = new Glib::Module(Shared::module_path(name), Glib::MODULE_BIND_LAZY); + // FIXME: SEGV on exit without this module->make_resident(); diff --git a/src/shared/runtime_paths.cpp b/src/shared/runtime_paths.cpp index 476bd2ba..f4ddd897 100644 --- a/src/shared/runtime_paths.cpp +++ b/src/shared/runtime_paths.cpp @@ -85,14 +85,19 @@ data_file_path(const std::string& name) /** Return the absolute path of a module (dynamically loaded shared library). */ std::string -module_path(const std::string& name) +module_path(const std::string& name, std::string dir) { std::string ret; + if (dir == "") { #ifdef BUNDLE - ret = Glib::Module::build_path(Glib::build_path(bundle_path, INGEN_MODULE_DIR), name); + dir = Glib::build_path(bundle_path, INGEN_MODULE_DIR); #else - ret = Glib::Module::build_path(INGEN_MODULE_DIR, name); + dir = INGEN_MODULE_DIR; #endif + } + + ret = Glib::Module::build_path(dir, name); + #ifdef __APPLE__ // MacPorts glib doesnt seem to do portable path building correctly... if (ret.substr(ret.length() - 3) == ".so") diff --git a/src/shared/runtime_paths.hpp b/src/shared/runtime_paths.hpp index c0c890c1..fcb29a7f 100644 --- a/src/shared/runtime_paths.hpp +++ b/src/shared/runtime_paths.hpp @@ -32,7 +32,7 @@ void set_bundle_path_from_code(void* function); std::string bundle_file_path(const std::string& name); std::string data_file_path(const std::string& name); -std::string module_path(const std::string& name); +std::string module_path(const std::string& name, std::string dir=""); } // namespace Ingen } // namespace Shared |