From 89676040530f5336ff157598870bfaff0d7d4aad Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim-Philipp=20M=C3=BCller?= Date: Wed, 20 Jan 2010 09:45:06 +0000 Subject: [PATCH] pluginloader: try scanner set via env var before using the installed one If the GST_PLUGIN_SCANNER environment variable is set, we should try the scanner specified there first, to make sure the right scanner binary is used for uninstalled setups and builds from source when there's already an installed version. --- gst/gstpluginloader.c | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/gst/gstpluginloader.c b/gst/gstpluginloader.c index b987c89942..3b87736c80 100644 --- a/gst/gstpluginloader.c +++ b/gst/gstpluginloader.c @@ -376,29 +376,32 @@ gst_plugin_loader_try_helper (GstPluginLoader * loader, gchar * location) static gboolean gst_plugin_loader_spawn (GstPluginLoader * loader) { + const gchar *env; char *helper_bin; - gboolean res; + gboolean res = FALSE; if (loader->child_running) return TRUE; - /* Find the gst-plugin-scanner, first try installed then by env-var */ - helper_bin = g_strdup (GST_PLUGIN_SCANNER_INSTALLED); - res = gst_plugin_loader_try_helper (loader, helper_bin); - g_free (helper_bin); + /* Find the gst-plugin-scanner: first try the env-var if it is set, + * otherwise use the installed version */ + env = g_getenv ("GST_PLUGIN_SCANNER"); + + if (env != NULL && *env != '\0') { + GST_LOG ("Trying GST_PLUGIN_SCANNER env var: %s", env); + helper_bin = g_strdup (env); + res = gst_plugin_loader_try_helper (loader, helper_bin); + g_free (helper_bin); + } if (!res) { - /* Try the GST_PLUGIN_SCANNER env var */ - const gchar *env = g_getenv ("GST_PLUGIN_SCANNER"); - if (env != NULL) { - GST_LOG ("Installed plugin scanner failed. " - "Trying GST_PLUGIN_SCANNER env var: %s", env); - helper_bin = g_strdup (env); - res = gst_plugin_loader_try_helper (loader, helper_bin); - g_free (helper_bin); - } else { - GST_LOG ("Installed plugin scanner failed and GST_PLUGIN_SCANNER " - " env var not set. No gst-plugin-scanner available"); + GST_LOG ("Trying installed plugin scanner"); + helper_bin = g_strdup (GST_PLUGIN_SCANNER_INSTALLED); + res = gst_plugin_loader_try_helper (loader, helper_bin); + g_free (helper_bin); + + if (!res) { + GST_INFO ("No gst-plugin-scanner available, or not working"); } } -- 2.34.1