Fix removing leading double slashes in filenames which are used for network resources on Windows (closes #2844085).
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@4139 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
55b68b76fa
commit
f114ba9900
@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
* src/build.c, src/filetypes.c:
|
* src/build.c, src/filetypes.c:
|
||||||
Fix compiler warnings.
|
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>
|
2009-08-27 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
|
||||||
|
|||||||
@ -1719,13 +1719,20 @@ void utils_tidy_path(gchar *filename)
|
|||||||
const gchar *c, *needle;
|
const gchar *c, *needle;
|
||||||
gchar *tmp;
|
gchar *tmp;
|
||||||
gssize pos;
|
gssize pos;
|
||||||
|
gboolean preserve_double_backslash = FALSE;
|
||||||
|
|
||||||
g_return_if_fail(g_path_is_absolute(filename));
|
g_return_if_fail(g_path_is_absolute(filename));
|
||||||
|
|
||||||
|
if (str->len >= 2 && strncmp(str->str, "\\\\", 2) == 0)
|
||||||
|
preserve_double_backslash = TRUE;
|
||||||
|
|
||||||
/* replace "/./" and "//" */
|
/* 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);
|
||||||
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 "/.." */
|
/* replace "/.." */
|
||||||
needle = G_DIR_SEPARATOR_S "..";
|
needle = G_DIR_SEPARATOR_S "..";
|
||||||
while (1)
|
while (1)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user