Fix opening filenames beginning with two dots (closes #2858487).

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@4183 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Nick Treleaven 2009-09-14 11:14:23 +00:00
parent 8dbaee549d
commit f4822ae10a
2 changed files with 12 additions and 4 deletions

View File

@ -1,3 +1,9 @@
2009-09-14 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* src/utils.c:
Fix opening filenames beginning with two dots (closes #2858487).
2009-09-13 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* src/keybindings.c:

View File

@ -1733,8 +1733,8 @@ void utils_tidy_path(gchar *filename)
if (preserve_double_backslash)
g_string_prepend(str, "\\");
/* replace "/.." */
needle = G_DIR_SEPARATOR_S "..";
/* replace "/../" */
needle = G_DIR_SEPARATOR_S ".." G_DIR_SEPARATOR_S;
while (1)
{
c = strstr(str->str, needle);
@ -1746,9 +1746,11 @@ void utils_tidy_path(gchar *filename)
if (pos <= 3)
break; /* bad path */
g_string_erase(str, pos, strlen(needle)); /* erase "/.." */
/* replace "/../" */
g_string_erase(str, pos, strlen(needle));
g_string_insert_c(str, pos, G_DIR_SEPARATOR);
tmp = g_strndup(str->str, pos); /* path up to "/.." */
tmp = g_strndup(str->str, pos); /* path up to "/../" */
c = g_strrstr(tmp, G_DIR_SEPARATOR_S);
g_return_if_fail(c);