[gdk-pixbuf] Use dynamically constructed replacement for GDK_PIXBUF_LIBDIR on Windows



commit 737e577536a54e7ef21e64faf922a6c41dbb06bd
Author: Tor Lillqvist <tml iki fi>
Date:   Mon Dec 27 14:51:13 2010 +0200

    Use dynamically constructed replacement for GDK_PIXBUF_LIBDIR on Windows
    
    Instead of the hardcoded configure- and compile-time GDK_PIXBUF_LIBDIR
    which is not expected to exist at run-time at all, use a pathname
    constructed from where the program binary is, and assuming the normal
    conventions.
    
    This gets used in the --update-cache case to construct the pathname of
    the loaders.cache file.
    
    Note that there already is similar code in main() to construct the
    pathname to where the loader DLLs normally are. There is probably some
    degree of overlap there that could be factored out, but I don't care.

 gdk-pixbuf/queryloaders.c |   29 +++++++++++++++++++++++++++++
 1 files changed, 29 insertions(+), 0 deletions(-)
---
diff --git a/gdk-pixbuf/queryloaders.c b/gdk-pixbuf/queryloaders.c
index 037c39a..6087bd8 100644
--- a/gdk-pixbuf/queryloaders.c
+++ b/gdk-pixbuf/queryloaders.c
@@ -212,6 +212,35 @@ query_module (GString *contents, const char *dir, const char *file)
         g_free (path);
 }
 
+#ifdef G_OS_WIN32
+
+static char *
+get_toplevel (void)
+{
+  static char *toplevel = NULL;
+
+  if (toplevel == NULL)
+          toplevel = g_win32_get_package_installation_directory_of_module (NULL);
+
+  return toplevel;
+}
+
+static char *
+get_libdir (void)
+{
+  static char *libdir = NULL;
+
+  if (libdir == NULL)
+          libdir = g_build_filename (get_toplevel (), "lib", NULL);
+
+  return libdir;
+}
+
+#undef GDK_PIXBUF_LIBDIR
+#define GDK_PIXBUF_LIBDIR get_libdir()
+
+#endif
+
 static gchar *
 gdk_pixbuf_get_module_file (void)
 {



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