From 98371e822eb7f3d4ba0ab64c9106ef5572d8c668 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Dzi=C4=99giel?= Date: Mon, 17 Jun 2024 21:41:11 +0200 Subject: [PATCH] gst-plugin: Allow overriding importers path with env variable --- src/lib/gst/plugin/gstclapperimporterloader.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/lib/gst/plugin/gstclapperimporterloader.c b/src/lib/gst/plugin/gstclapperimporterloader.c index eb5d73e2..85ca6806 100644 --- a/src/lib/gst/plugin/gstclapperimporterloader.c +++ b/src/lib/gst/plugin/gstclapperimporterloader.c @@ -115,11 +115,14 @@ _obtain_available_modules_once (G_GNUC_UNUSED gpointer data) GFile *dir; GFileEnumerator *dir_enum; GError *error = NULL; + const gchar *imp_path, *env_path = g_getenv ("CLAPPER_SINK_IMPORTER_PATH"); GST_INFO ("Preparing modules"); modules = g_ptr_array_new (); - dir = g_file_new_for_path (CLAPPER_SINK_IMPORTER_PATH); + + imp_path = (env_path && env_path[0]) ? env_path : CLAPPER_SINK_IMPORTER_PATH; + dir = g_file_new_for_path (imp_path); if ((dir_enum = g_file_enumerate_children (dir, G_FILE_ATTRIBUTE_STANDARD_NAME, @@ -139,7 +142,7 @@ _obtain_available_modules_once (G_GNUC_UNUSED gpointer data) if (!g_str_has_suffix (module_name, G_MODULE_SUFFIX)) continue; - module_path = g_module_build_path (CLAPPER_SINK_IMPORTER_PATH, module_name); + module_path = g_module_build_path (imp_path, module_name); module = g_module_open (module_path, G_MODULE_BIND_LAZY); g_free (module_path);