Compare filenames using g_file_equal()
authorJohan Dahlin <johan@gnome.org>
Mon, 9 Apr 2012 15:24:49 +0000 (12:24 -0300)
committerJohan Dahlin <jdahlin@litl.com>
Mon, 9 Apr 2012 15:24:49 +0000 (12:24 -0300)
Makes it work on case-sensitive file systems such as HFS+.

https://bugzilla.gnome.org/show_bug.cgi?id=667405

Makefile-giscanner.am
giscanner/giscannermodule.c
giscanner/sourcescanner.c

index f20135aefa864e94592e5c2780b437e698ab5c70..d4d2a6203ef584aa5c248b9580b613d5e7eb6486 100644 (file)
@@ -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
index 81adbd8ccc2cb9878807bde83134532402b8dc3e..0da20f182b97905743c07c6517691528711cb737 100644 (file)
@@ -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.
index 1ae14bc3264d0eb4433dbe61af8efe9adc42a36f..1b775b466de59b1569c3899315394a28fcda68a2 100644 (file)
@@ -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 *