From 8b8c9a4f348439bc11bdaa3ce9f3c9f1032d6825 Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Sat, 10 Mar 2012 17:25:05 +0300 Subject: [PATCH] (panel_reload): fixup of panel current directory obtain. Signed-off-by: Andrew Borodin --- src/filemanager/panel.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/filemanager/panel.c b/src/filemanager/panel.c index da876fd08..3b11d2036 100644 --- a/src/filemanager/panel.c +++ b/src/filemanager/panel.c @@ -4174,7 +4174,7 @@ panel_reload (WPanel * panel) break; tmp_path = vfs_path_to_str (panel->cwd_vpath); - if (tmp_path[0] == PATH_SEP && tmp_path[1] == 0) + if (tmp_path[0] == PATH_SEP && tmp_path[1] == '\0') { panel_clean_dir (panel); panel->count = set_zero_dir (&panel->dir) ? 1 : 0; @@ -4182,15 +4182,16 @@ panel_reload (WPanel * panel) return; } last_slash = strrchr (tmp_path, PATH_SEP); - if (!last_slash || last_slash == tmp_path) - { - vfs_path_free (panel->cwd_vpath); + vfs_path_free (panel->cwd_vpath); + if (last_slash == NULL || last_slash == tmp_path) panel->cwd_vpath = vfs_path_from_str (PATH_SEP_STR); - } else - *last_slash = 0; - memset (&(panel->dir_stat), 0, sizeof (panel->dir_stat)); + { + *last_slash = '\0'; + panel->cwd_vpath = vfs_path_from_str (tmp_path); + } g_free (tmp_path); + memset (&(panel->dir_stat), 0, sizeof (panel->dir_stat)); show_dir (panel); } while (TRUE);