mirror of
https://gitlab.freedesktop.org/pipewire/wireplumber.git
synced 2026-05-04 15:28:06 +02:00
wp: export functions to get the module & config dirs
This commit is contained in:
parent
0d072874a1
commit
cb228637d6
4 changed files with 33 additions and 14 deletions
|
|
@ -14,7 +14,7 @@
|
|||
#define G_LOG_DOMAIN "wp-comp-loader"
|
||||
|
||||
#include "component-loader.h"
|
||||
#include "error.h"
|
||||
#include "wp.h"
|
||||
#include "private/registry.h"
|
||||
#include <pipewire/impl.h>
|
||||
|
||||
|
|
@ -33,18 +33,6 @@ wp_component_loader_class_init (WpComponentLoaderClass * klass)
|
|||
{
|
||||
}
|
||||
|
||||
static const gchar *
|
||||
get_module_dir (void)
|
||||
{
|
||||
static const gchar *module_dir = NULL;
|
||||
if (!module_dir) {
|
||||
module_dir = g_getenv ("WIREPLUMBER_MODULE_DIR");
|
||||
if (!module_dir)
|
||||
module_dir = WIREPLUMBER_DEFAULT_MODULE_DIR;
|
||||
}
|
||||
return module_dir;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
load_module (WpCore * core, const gchar * module_name,
|
||||
GVariant * args, GError ** error)
|
||||
|
|
@ -53,7 +41,7 @@ load_module (WpCore * core, const gchar * module_name,
|
|||
GModule *gmodule;
|
||||
gpointer module_init;
|
||||
|
||||
module_path = g_module_build_path (get_module_dir (), module_name);
|
||||
module_path = g_module_build_path (wp_get_module_dir (), module_name);
|
||||
gmodule = g_module_open (module_path, G_MODULE_BIND_LOCAL);
|
||||
if (!gmodule) {
|
||||
g_set_error (error, WP_DOMAIN_LIBRARY, WP_LIBRARY_ERROR_OPERATION_FAILED,
|
||||
|
|
|
|||
|
|
@ -104,6 +104,7 @@ wp_lib = library('wireplumber-' + wireplumber_api_version,
|
|||
'-D_GNU_SOURCE',
|
||||
'-DG_LOG_USE_STRUCTURED',
|
||||
'-DWIREPLUMBER_DEFAULT_MODULE_DIR="@0@"'.format(wireplumber_module_dir),
|
||||
'-DWIREPLUMBER_DEFAULT_CONFIG_DIR="@0@"'.format(wireplumber_config_dir),
|
||||
'-DBUILDING_WP',
|
||||
],
|
||||
install: true,
|
||||
|
|
|
|||
24
lib/wp/wp.c
24
lib/wp/wp.c
|
|
@ -78,3 +78,27 @@ wp_init (WpInitFlags flags)
|
|||
g_type_ensure (WP_TYPE_PORT);
|
||||
g_type_ensure (WP_TYPE_SESSION);
|
||||
}
|
||||
|
||||
const gchar *
|
||||
wp_get_module_dir (void)
|
||||
{
|
||||
static const gchar *module_dir = NULL;
|
||||
if (!module_dir) {
|
||||
module_dir = g_getenv ("WIREPLUMBER_MODULE_DIR");
|
||||
if (!module_dir)
|
||||
module_dir = WIREPLUMBER_DEFAULT_MODULE_DIR;
|
||||
}
|
||||
return module_dir;
|
||||
}
|
||||
|
||||
const gchar *
|
||||
wp_get_config_dir (void)
|
||||
{
|
||||
static const gchar *config_dir = NULL;
|
||||
if (!config_dir) {
|
||||
config_dir = g_getenv ("WIREPLUMBER_CONFIG_DIR");
|
||||
if (!config_dir)
|
||||
config_dir = WIREPLUMBER_DEFAULT_CONFIG_DIR;
|
||||
}
|
||||
return config_dir;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,6 +58,12 @@ typedef enum {
|
|||
WP_API
|
||||
void wp_init (WpInitFlags flags);
|
||||
|
||||
WP_API
|
||||
const gchar * wp_get_module_dir (void);
|
||||
|
||||
WP_API
|
||||
const gchar * wp_get_config_dir (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue