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:
parent
8dbaee549d
commit
f4822ae10a
@ -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:
|
||||
|
||||
10
src/utils.c
10
src/utils.c
@ -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);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user