Kaydet (Commit) 7e704a20 authored tarafından Nick Treleaven's avatar Nick Treleaven

Don't dereference symlinks.

Make sure current_dir always has a full path.


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@1990 ea778897-0a13-0410-b9d1-a72fbfd435f5
üst 25b85ba0
...@@ -15,6 +15,9 @@ ...@@ -15,6 +15,9 @@
Disable project menu item when no project is open. Disable project menu item when no project is open.
* src/document.c: * src/document.c:
Make Fold All/Unfold All attempt to scroll the current line in view. Make Fold All/Unfold All attempt to scroll the current line in view.
* plugins/filebrowser.c:
Don't dereference symlinks.
Make sure current_dir always has a full path.
2007-10-28 Enrico Tröger <enrico.troeger@uvena.de> 2007-10-28 Enrico Tröger <enrico.troeger@uvena.de>
......
...@@ -153,9 +153,6 @@ static void refresh() ...@@ -153,9 +153,6 @@ static void refresh()
clear(); clear();
// TODO: really, we don't want to dereference symlinks
setptr(current_dir, tagm->get_real_path(current_dir));
utf8_dir = utils->get_utf8_from_locale(current_dir); utf8_dir = utils->get_utf8_from_locale(current_dir);
gtk_entry_set_text(GTK_ENTRY(path_entry), utf8_dir); gtk_entry_set_text(GTK_ENTRY(path_entry), utf8_dir);
g_free(utf8_dir); g_free(utf8_dir);
...@@ -170,21 +167,29 @@ static void refresh() ...@@ -170,21 +167,29 @@ static void refresh()
} }
static void on_go_home()
{
setptr(current_dir, g_strdup(g_get_home_dir()));
refresh();
}
static void on_current_path() static void on_current_path()
{ {
gchar *fname; gchar *fname;
gchar *dir; gchar *dir;
gint idx = documents->get_cur_idx(); gint idx = documents->get_cur_idx();
if (DOC_IDX_VALID(idx)) if (! DOC_IDX_VALID(idx) || doc_list[idx].file_name == NULL ||
! g_path_is_absolute(doc_list[idx].file_name))
{ {
fname = DOC_FILENAME(idx); on_go_home();
return;
}
fname = doc_list[idx].file_name;
fname = utils->get_locale_from_utf8(fname); fname = utils->get_locale_from_utf8(fname);
dir = g_path_get_dirname(fname); dir = g_path_get_dirname(fname);
g_free(fname); g_free(fname);
}
else
dir = g_strdup(".");
setptr(current_dir, dir); setptr(current_dir, dir);
refresh(); refresh();
...@@ -331,16 +336,10 @@ static gboolean on_button_press(GtkWidget *widget, GdkEventButton *event, gpoint ...@@ -331,16 +336,10 @@ static gboolean on_button_press(GtkWidget *widget, GdkEventButton *event, gpoint
} }
static void on_go_home()
{
setptr(current_dir, g_strdup(g_get_home_dir()));
refresh();
}
static void on_go_up() static void on_go_up()
{ {
setptr(current_dir, g_build_path(G_DIR_SEPARATOR_S, current_dir, "..", NULL)); // remove the highest directory part (which becomes the basename of current_dir)
setptr(current_dir, g_path_get_dirname(current_dir));
refresh(); refresh();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment