Ticket #2590: M-o works unexpectedly on symlink shortcuts

(chdir_other_panel): symbolic link to directory is handled now
as directory.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2011-08-11 12:48:42 +04:00
parent c81c3e4244
commit 10537ca05d

View File

@ -2339,6 +2339,8 @@ do_enter (WPanel * panel)
static void static void
chdir_other_panel (WPanel * panel) chdir_other_panel (WPanel * panel)
{ {
const file_entry *entry = &panel->dir.list[panel->selected];
char *new_dir; char *new_dir;
char *sel_entry = NULL; char *sel_entry = NULL;
@ -2347,13 +2349,13 @@ chdir_other_panel (WPanel * panel)
set_display_type (get_other_index (), view_listing); set_display_type (get_other_index (), view_listing);
} }
if (!S_ISDIR (panel->dir.list[panel->selected].st.st_mode)) if (S_ISDIR (entry->st.st_mode) || entry->f.link_to_dir)
new_dir = mc_build_filename (panel->cwd, entry->fname, (char *) NULL);
else
{ {
new_dir = concat_dir_and_file (panel->cwd, ".."); new_dir = mc_build_filename (panel->cwd, "..", (char *) NULL);
sel_entry = strrchr (panel->cwd, PATH_SEP); sel_entry = strrchr (panel->cwd, PATH_SEP);
} }
else
new_dir = concat_dir_and_file (panel->cwd, panel->dir.list[panel->selected].fname);
change_panel (); change_panel ();
do_cd (new_dir, cd_exact); do_cd (new_dir, cd_exact);