SF.net SVN: geany:[4139] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Sat Aug 29 19:06:19 UTC 2009


Revision: 4139
          http://geany.svn.sourceforge.net/geany/?rev=4139&view=rev
Author:   eht16
Date:     2009-08-29 19:06:19 +0000 (Sat, 29 Aug 2009)

Log Message:
-----------
Fix removing leading double slashes in filenames which are used for network resources on Windows (closes #2844085).

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/utils.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2009-08-29 18:44:14 UTC (rev 4138)
+++ trunk/ChangeLog	2009-08-29 19:06:19 UTC (rev 4139)
@@ -2,6 +2,9 @@
 
  * src/build.c, src/filetypes.c:
    Fix compiler warnings.
+ * src/utils.c:
+   Fix removing leading double slashes in filenames which are used for
+   network resources on Windows (closes #2844085).
 
 
 2009-08-27  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>

Modified: trunk/src/utils.c
===================================================================
--- trunk/src/utils.c	2009-08-29 18:44:14 UTC (rev 4138)
+++ trunk/src/utils.c	2009-08-29 19:06:19 UTC (rev 4139)
@@ -1719,13 +1719,20 @@
 	const gchar *c, *needle;
 	gchar *tmp;
 	gssize pos;
+	gboolean preserve_double_backslash = FALSE;
 
 	g_return_if_fail(g_path_is_absolute(filename));
 
+	if (str->len >= 2 && strncmp(str->str, "\\\\", 2) == 0)
+		preserve_double_backslash = TRUE;
+
 	/* replace "/./" and "//" */
 	utils_string_replace_all(str, G_DIR_SEPARATOR_S "." G_DIR_SEPARATOR_S, G_DIR_SEPARATOR_S);
 	utils_string_replace_all(str, G_DIR_SEPARATOR_S G_DIR_SEPARATOR_S, G_DIR_SEPARATOR_S);
 
+	if (preserve_double_backslash)
+		g_string_prepend(str, "\\");
+
 	/* replace "/.." */
 	needle = G_DIR_SEPARATOR_S "..";
 	while (1)


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list