[libpeas] Use the program name for python args if available



commit c0f579d9967d3e64e0fc61f7037791fc02ceae62
Author: Garrett Regier <alias301 gmail com>
Date:   Sun Jun 27 12:06:01 2010 -0700

    Use the program name for python args if available
    
    So python plugins now should be given the running program's name.

 loaders/python/peas-plugin-loader-python.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/loaders/python/peas-plugin-loader-python.c b/loaders/python/peas-plugin-loader-python.c
index 0c1d4a2..d68445b 100644
--- a/loaders/python/peas-plugin-loader-python.c
+++ b/loaders/python/peas-plugin-loader-python.c
@@ -380,7 +380,8 @@ static gboolean
 peas_python_init (PeasPluginLoaderPython *loader)
 {
   PyObject *mdict, *gobject, *gi, *gettext, *install, *gettext_args;
-  char *argv[] = { "libpeas", NULL };
+  char *argv[] = { "", NULL };
+  gchar *prgname;
 
   if (loader->priv->init_failed)
     {
@@ -403,6 +404,10 @@ peas_python_init (PeasPluginLoaderPython *loader)
   /* Python initialization */
   Py_InitializeEx (FALSE);
 
+  prgname = g_get_prgname ();
+  if (prgname != NULL)
+      argv[0] = prgname;
+
   PySys_SetArgv (1, argv);
 
   peas_plugin_loader_python_add_module_path (loader, PEAS_PYEXECDIR);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]