summaryrefslogtreecommitdiff
path: root/gdk-pixbuf/queryloaders.c
diff options
context:
space:
mode:
authorIgnacio Casal Quinteiro <qignacio@amazon.com>2018-01-05 17:01:42 +0100
committerIgnacio Casal Quinteiro <qignacio@amazon.com>2018-01-12 08:50:15 +0100
commit49d4becc33ca6bc99199dc845f3413e16eeb7f53 (patch)
treee8cb1c5daf22ef2af795703f277e65ab8344b29c /gdk-pixbuf/queryloaders.c
parent49d722168029f0d897279bae5704d1fb930900f8 (diff)
downloadgdk-pixbuf-49d4becc33ca6bc99199dc845f3413e16eeb7f53.tar.gz
queryloaders: standardize the dir paths before checking them
On windows we are checking if the PIXBUF_LIBDIR starts with GDK_PIXBUF_PREFIX. The problem is that they might be defined with a different path dir. For this we use a GFile which makes the paths to use the one used by the platform.
Diffstat (limited to 'gdk-pixbuf/queryloaders.c')
-rw-r--r--gdk-pixbuf/queryloaders.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/gdk-pixbuf/queryloaders.c b/gdk-pixbuf/queryloaders.c
index da72ab30d..2b025b88c 100644
--- a/gdk-pixbuf/queryloaders.c
+++ b/gdk-pixbuf/queryloaders.c
@@ -257,19 +257,31 @@ int main (int argc, char **argv)
GString *contents;
gchar *cache_file = NULL;
gint first_file = 1;
+ GFile *pixbuf_libdir_file;
gchar *pixbuf_libdir;
- pixbuf_libdir = g_strdup (PIXBUF_LIBDIR);
+ /* An intermediate GFile here will convert all the path separators
+ * to the right one used by the platform
+ */
+ pixbuf_libdir_file = g_file_new_for_path (PIXBUF_LIBDIR);
+ pixbuf_libdir = g_file_get_path (pixbuf_libdir_file);
+ g_object_unref (pixbuf_libdir_file);
#ifdef G_OS_WIN32
gchar *libdir;
+ GFile *pixbuf_prefix_file;
+ gchar *pixbuf_prefix;
- if (g_ascii_strncasecmp (pixbuf_libdir, GDK_PIXBUF_PREFIX, strlen (GDK_PIXBUF_PREFIX)) == 0 &&
- G_IS_DIR_SEPARATOR (pixbuf_libdir[strlen (GDK_PIXBUF_PREFIX)])) {
+ pixbuf_prefix_file = g_file_new_for_path (GDK_PIXBUF_PREFIX);
+ pixbuf_prefix = g_file_get_path (pixbuf_prefix_file);
+ g_object_unref (pixbuf_prefix_file);
+
+ if (g_ascii_strncasecmp (pixbuf_libdir, pixbuf_prefix, strlen (pixbuf_prefix)) == 0 &&
+ G_IS_DIR_SEPARATOR (pixbuf_libdir[strlen (pixbuf_prefix)])) {
gchar *runtime_prefix;
gchar *slash;
- /* GDK_PIXBUF_PREFIX is a prefix of pixbuf_libdir, as it
+ /* pixbuf_prefix is a prefix of pixbuf_libdir, as it
* normally is. Replace that prefix in pixbuf_libdir
* with the installation directory on this machine.
* We assume this invokation of
@@ -300,7 +312,7 @@ int main (int argc, char **argv)
}
libdir = g_build_filename (runtime_prefix,
- pixbuf_libdir + strlen (GDK_PIXBUF_PREFIX) + 1,
+ pixbuf_libdir + strlen (pixbuf_prefix) + 1,
NULL);
}
}
@@ -308,6 +320,8 @@ int main (int argc, char **argv)
libdir = NULL;
}
+ g_free (pixbuf_prefix);
+
if (libdir != NULL) {
g_free (pixbuf_libdir);
pixbuf_libdir = libdir;