[gdk-pixbuf] queryloaders: standardize the dir paths before checking them
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gdk-pixbuf] queryloaders: standardize the dir paths before checking them
- Date: Fri, 12 Jan 2018 07:51:13 +0000 (UTC)
commit 49d4becc33ca6bc99199dc845f3413e16eeb7f53
Author: Ignacio Casal Quinteiro <qignacio amazon com>
Date: Fri Jan 5 17:01:42 2018 +0100
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.
gdk-pixbuf/queryloaders.c | 24 +++++++++++++++++++-----
1 files changed, 19 insertions(+), 5 deletions(-)
---
diff --git a/gdk-pixbuf/queryloaders.c b/gdk-pixbuf/queryloaders.c
index da72ab3..2b025b8 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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]