Skip to content
Snippets Groups Projects
Commit cb228637 authored by George Kiagiadakis's avatar George Kiagiadakis
Browse files

wp: export functions to get the module & config dirs

parent 0d072874
No related branches found
No related tags found
No related merge requests found
......@@ -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,
......
......@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment