From 77dc6935334eb2915f3fb536ff964a6cea256007 Mon Sep 17 00:00:00 2001 From: Julian Sparber Date: Thu, 22 Sep 2022 17:54:44 +0200 Subject: [PATCH] manager: Only set search path from CALLS_PLUGIN_DIR when path exists Libpeas has issues searching in a path that doesn't exsist. --- src/calls-manager.c | 9 +++++++-- tests/test-plugins.c | 8 ++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/calls-manager.c b/src/calls-manager.c index 3a89897..46ed6fc 100644 --- a/src/calls-manager.c +++ b/src/calls-manager.c @@ -805,8 +805,13 @@ calls_manager_init (CallsManager *self) g_autofree char *plugin_dir_provider = NULL; plugin_dir_provider = g_build_filename (dir, "provider", NULL); - g_debug ("Adding %s to plugin search path", plugin_dir_provider); - peas_engine_prepend_search_path (peas, plugin_dir_provider, NULL); + + if (g_file_test (plugin_dir_provider, G_FILE_TEST_EXISTS)) { + g_debug ("Adding %s to plugin search path", plugin_dir_provider); + peas_engine_prepend_search_path (peas, plugin_dir_provider, NULL); + } else { + g_warning ("Not adding %s to plugin search path, because the directory doesn't exist. Check if env CALLS_PLUGIN_DIR is set correctly", plugin_dir_provider); + } } default_plugin_dir_provider = g_build_filename(PLUGIN_LIBDIR, "provider", NULL); diff --git a/tests/test-plugins.c b/tests/test-plugins.c index 1af15cc..d2df6ec 100644 --- a/tests/test-plugins.c +++ b/tests/test-plugins.c @@ -60,8 +60,12 @@ main (gint argc, if (dir && dir[0] != '\0') { g_autofree char *plugin_dir_provider = NULL; plugin_dir_provider = g_build_filename (dir, "provider", NULL); - g_debug ("Adding %s to plugin search path", plugin_dir_provider); - peas_engine_prepend_search_path (peas, plugin_dir_provider, NULL); + if (g_file_test (plugin_dir_provider, G_FILE_TEST_EXISTS)) { + g_debug ("Adding %s to plugin search path", plugin_dir_provider); + peas_engine_prepend_search_path (peas, plugin_dir_provider, NULL); + } else { + g_warning ("Not adding %s to plugin search path, because the directory doesn't exist. Check if env CALLS_PLUGIN_DIR is set correctly", plugin_dir_provider); + } } default_plugin_dir_provider = g_build_filename (PLUGIN_LIBDIR, "provider", NULL);