base-dirs: add support for finding modules and remove wp_get_module_dir()
This makes things more consistent and allows us also to add more search paths in the future if necessary. Also, stop using g_module_build_path() because it's deprecated and build the path manually. This obviously is not portable to Windows/Mac or other exotic platforms, but portability is not important at this point. PipeWire is also not portable beyond Linux & BSD.
This commit is contained in:
@@ -698,10 +698,12 @@ load_module (WpCore * core, const gchar * module_name, WpSpaJson * args,
|
||||
GModule *gmodule;
|
||||
gpointer module_init;
|
||||
|
||||
if (!g_file_test (module_name, G_FILE_TEST_EXISTS))
|
||||
module_path = g_module_build_path (wp_get_module_dir (), module_name);
|
||||
else
|
||||
module_path = g_strdup (module_name);
|
||||
module_path = wp_base_dirs_find_file (WP_BASE_DIRS_MODULE, NULL, module_name);
|
||||
if (!module_path) {
|
||||
g_set_error (error, WP_DOMAIN_LIBRARY, WP_LIBRARY_ERROR_OPERATION_FAILED,
|
||||
"Failed to locate module %s", module_name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
wp_trace_object (core, "loading %s from %s", module_name, module_path);
|
||||
|
||||
|
Reference in New Issue
Block a user