[gobject-introspection] Compare filenames using g_file_equal()



commit 47d4e9509a8ffde1cab4a6f8d2be4ce232ba1cfb
Author: Johan Dahlin <johan gnome org>
Date:   Mon Apr 9 12:24:49 2012 -0300

    Compare filenames using g_file_equal()
    
    Makes it work on case-sensitive file systems such as HFS+.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=667405

 Makefile-giscanner.am       |    4 ++--
 giscanner/giscannermodule.c |    4 ++++
 giscanner/sourcescanner.c   |   12 +++++++++++-
 3 files changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/Makefile-giscanner.am b/Makefile-giscanner.am
index f20135a..d4d2a62 100644
--- a/Makefile-giscanner.am
+++ b/Makefile-giscanner.am
@@ -20,8 +20,8 @@ libgiscanner_la_SOURCES = \
 	giscanner/scannerparser.y				\
 	giscanner/grealpath.h
 libgiscanner_la_CPPFLAGS = -I$(top_srcdir)/girepository -I$(top_srcdir)/giscanner
-libgiscanner_la_LIBADD = $(GOBJECT_LIBS)
-libgiscanner_la_CFLAGS = $(GOBJECT_CFLAGS)
+libgiscanner_la_LIBADD = $(GOBJECT_LIBS) $(GIO_LIBS)
+libgiscanner_la_CFLAGS = $(GOBJECT_CFLAGS) $(GIO_CFLAGS)
 
 # Python module
 pkgpyexecdir = $(pkglibdir)/giscanner
diff --git a/giscanner/giscannermodule.c b/giscanner/giscannermodule.c
index 81adbd8..0da20f1 100644
--- a/giscanner/giscannermodule.c
+++ b/giscanner/giscannermodule.c
@@ -38,6 +38,8 @@
 #include <windows.h>
 #endif
 
+#include <glib-object.h>
+
 DL_EXPORT(void) init_giscanner(void);
 
 #define NEW_CLASS(ctype, name, cname)	      \
@@ -720,6 +722,8 @@ init_giscanner(void)
     PyObject *m, *d;
     gboolean is_uninstalled;
 
+    g_type_init ();
+
     /* Hack to avoid having to create a fake directory structure; when
      * running uninstalled, the module will be in the top builddir,
      * with no _giscanner prefix.
diff --git a/giscanner/sourcescanner.c b/giscanner/sourcescanner.c
index 1ae14bc..1b775b4 100644
--- a/giscanner/sourcescanner.c
+++ b/giscanner/sourcescanner.c
@@ -22,6 +22,7 @@
 
 #include "sourcescanner.h"
 #include <string.h>
+#include <gio/gio.h>
 
 GISourceSymbol *
 gi_source_symbol_new (GISourceSymbolType type, const gchar *filename, int line)
@@ -242,15 +243,22 @@ gi_source_scanner_add_symbol (GISourceScanner  *scanner,
 {
   gboolean found_filename = FALSE;
   GList *l;
+  GFile *current_file;
 
   g_assert (scanner->current_filename);
+  current_file = g_file_new_for_path (scanner->current_filename);
+
   for (l = scanner->filenames; l != NULL; l = l->next)
     {
-      if (strcmp (l->data, scanner->current_filename) == 0)
+      GFile *file = g_file_new_for_path (l->data);
+
+      if (g_file_equal (file, current_file))
 	{
 	  found_filename = TRUE;
+          g_object_unref (file);
 	  break;
 	}
+      g_object_unref (file);
     }
 
   if (found_filename || scanner->macro_scan)
@@ -275,6 +283,8 @@ gi_source_scanner_add_symbol (GISourceScanner  *scanner,
     default:
       break;
     }
+
+    g_object_unref (current_file);
 }
 
 GSList *



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