diff options
author | Juan Pablo Ugarte <juanpablougarte@gmail.com> | 2020-06-08 20:49:16 -0300 |
---|---|---|
committer | Juan Pablo Ugarte <juanpablougarte@gmail.com> | 2020-06-10 16:05:17 -0300 |
commit | 32b5541d496f9dc640495920818e5a460b47f07a (patch) | |
tree | 684be9003305806282b59c65e738ecb87fc05ba5 | |
parent | 04a9f40342b4d294dc8e894687e3d73d3440e61d (diff) | |
download | glade-32b5541d496f9dc640495920818e5a460b47f07a.tar.gz |
Python plugin: support multiple paths in env variable
-rw-r--r-- | plugins/python/glade-python.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/plugins/python/glade-python.c b/plugins/python/glade-python.c index bbdbbe77..7927fcba 100644 --- a/plugins/python/glade-python.c +++ b/plugins/python/glade-python.c @@ -95,6 +95,7 @@ glade_python_setup () GString *command; const gchar *module_path; const GList *paths; + gchar **tokens = NULL; Py_SetProgramName (PY_STRING (PACKAGE_NAME)); @@ -140,9 +141,14 @@ glade_python_setup () command = g_string_new ("import sys; sys.path+=["); /* GLADE_ENV_MODULE_PATH has priority */ - module_path = g_getenv (GLADE_ENV_MODULE_PATH); - if (module_path) - g_string_append_printf (command, "'%s', ", module_path); + if ((module_path = g_getenv (GLADE_ENV_MODULE_PATH))) + { + tokens = g_strsplit(module_path, ":", -1); + gint i; + + for (i = 0; tokens[i]; i++) + g_string_append_printf (command, "'%s', ", tokens[i]); + } /* Append modules directory */ g_string_append_printf (command, "'%s'", glade_app_get_modules_dir ()); @@ -161,6 +167,7 @@ glade_python_setup () PyRun_SimpleString (command->str); g_string_free (command, TRUE); + g_strfreev (tokens); return FALSE; } |