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 @@
Disable project menu item when no project is open.
* src/document.c:
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>
......
......@@ -153,9 +153,6 @@ static void refresh()
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);
gtk_entry_set_text(GTK_ENTRY(path_entry), utf8_dir);
g_free(utf8_dir);
......@@ -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()
{
gchar *fname;
gchar *dir;
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);
fname = utils->get_locale_from_utf8(fname);
dir = g_path_get_dirname(fname);
g_free(fname);
on_go_home();
return;
}
else
dir = g_strdup(".");
fname = doc_list[idx].file_name;
fname = utils->get_locale_from_utf8(fname);
dir = g_path_get_dirname(fname);
g_free(fname);
setptr(current_dir, dir);
refresh();
......@@ -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()
{
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();
}
......
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