[glib] GLocalFile: canonicalize the initial directory separator



commit 468a166711ab78986b3404909c6d9c0cf3633bea
Author: Dan Winship <danw gnome org>
Date:   Sat Nov 10 11:09:18 2012 -0500

    GLocalFile: canonicalize the initial directory separator
    
    GLocalFile was (in certain situations) translating a path like
    "/foo/bar/baz" to "/foo\bar\baz" on win32. Fix it to make sure the
    initial directory separator gets canonicalized too.
    
    Fixes gio/tests/g-icon on win32.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=688109

 gio/glocalfile.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/gio/glocalfile.c b/gio/glocalfile.c
index eca2a11..ae60870 100644
--- a/gio/glocalfile.c
+++ b/gio/glocalfile.c
@@ -229,6 +229,11 @@ canonicalize_filename (const char *filename)
       start -= i;
       memmove (start, start+i, strlen (start+i)+1);
     }
+
+  /* Make sure we're using the canonical dir separator */
+  p++;
+  while (p < start && G_IS_DIR_SEPARATOR (*p))
+    *p++ = G_DIR_SEPARATOR;
   
   p = start;
   while (*p != 0)



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