summaryrefslogtreecommitdiff
path: root/gdk-pixbuf/queryloaders.c
diff options
context:
space:
mode:
authorTor Lillqvist <tml@iki.fi>2010-12-27 14:51:13 +0200
committerTor Lillqvist <tml@iki.fi>2010-12-27 14:51:13 +0200
commit737e577536a54e7ef21e64faf922a6c41dbb06bd (patch)
tree904efaeb85ddce45c7edba9f08015508c6f212e9 /gdk-pixbuf/queryloaders.c
parentd5d8f3cd8f7533601d2ceda5fcd12c47f64fa71b (diff)
downloadgdk-pixbuf-737e577536a54e7ef21e64faf922a6c41dbb06bd.tar.gz
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.
Diffstat (limited to 'gdk-pixbuf/queryloaders.c')
-rw-r--r--gdk-pixbuf/queryloaders.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/gdk-pixbuf/queryloaders.c b/gdk-pixbuf/queryloaders.c
index 037c39abf..6087bd8be 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)
{