Пример #1
0
gchar *
_gimp_reloc_find_plugin_dir (const gchar *default_plugin_dir)
{
        gchar *libdir, *dir;

        libdir = _gimp_reloc_find_lib_dir (NULL);
        if (libdir == NULL) {
                /* BinReloc not initialized. */
                if (default_plugin_dir != NULL)
                        return g_strdup (default_plugin_dir);
                else
                        return NULL;
        }

        dir = g_build_filename (libdir,
                                GIMP_PACKAGE,
                                GIMP_PLUGIN_VERSION,
                                NULL);
        g_free (libdir);
        return dir;
}
Пример #2
0
/**
 * gimp_env_init:
 * @plug_in: must be %TRUE if this function is called from a plug-in
 *
 * You don't need to care about this function. It is being called for
 * you automatically (by means of the MAIN() macro that every plug-in
 * runs). Calling it again will cause a fatal error.
 *
 * Since: GIMP 2.4
 */
void
gimp_env_init (gboolean plug_in)
{
  static gboolean gimp_env_initialized = FALSE;

  if (gimp_env_initialized)
    g_error ("gimp_env_init() must only be called once!");

  gimp_env_initialized = TRUE;

#ifndef G_OS_WIN32
  if (plug_in)
    {
      _gimp_reloc_init_lib (NULL);
    }
  else if (_gimp_reloc_init (NULL))
    {
      /* Set $LD_LIBRARY_PATH to ensure that plugins can be loaded. */

      const gchar *ldpath = g_getenv ("LD_LIBRARY_PATH");
      gchar       *libdir = _gimp_reloc_find_lib_dir (NULL);

      if (ldpath && *ldpath)
        {
          gchar *tmp = g_strconcat (libdir, ":", ldpath, NULL);

          g_setenv ("LD_LIBRARY_PATH", tmp, TRUE);

          g_free (tmp);
        }
      else
        {
          g_setenv ("LD_LIBRARY_PATH", libdir, TRUE);
        }

      g_free (libdir);
    }
#endif
}