pidgin/pidgin

Add an environment variable for Finch plugin search path

2021-10-01, Elliott Sales de Andrade
8c240e88aef6
Parents b61307e4df4f
Children c5ef99d267c3
Add an environment variable for Finch plugin search path

Testing Done:
Compiled only for now

Reviewed at https://reviews.imfreedom.org/r/969/
--- a/finch/libfinch.c Fri Oct 01 00:51:03 2021 -0500
+++ b/finch/libfinch.c Fri Oct 01 01:01:30 2021 -0500
@@ -83,6 +83,7 @@
gboolean debug_enabled = FALSE;
GOptionContext *context;
gchar **args;
+ const gchar *plugin_path = NULL;
GError *error = NULL;
GOptionEntry option_entries[] = {
@@ -171,6 +172,19 @@
abort();
}
+ plugin_path = g_getenv("FINCH_PLUGIN_PATH");
+ if (plugin_path) {
+ gchar **paths;
+ gint i;
+
+ paths = g_strsplit(plugin_path, G_SEARCHPATH_SEPARATOR_S, 0);
+ for (i = 0; paths[i]; ++i) {
+ purple_plugins_add_search_path(paths[i]);
+ }
+
+ g_strfreev(paths);
+ }
+
path = g_build_filename(purple_data_dir(), "plugins", NULL);
if (g_mkdir(path, S_IRUSR | S_IWUSR | S_IXUSR) != 0 && errno != EEXIST)
fprintf(stderr, "Couldn't create plugins dir\n");