diff --git a/src/filemanager/midnight.c b/src/filemanager/midnight.c index dd9c902ee..cc717c241 100644 --- a/src/filemanager/midnight.c +++ b/src/filemanager/midnight.c @@ -579,7 +579,10 @@ create_panels (void) other_index = 1; current_mode = startup_left_mode; other_mode = startup_right_mode; + /* if mc_run_param0 is NULL, working directory will be used for the left panel */ current_dir = mc_run_param0; + /* mc_run_param1 is never NULL. It is setup from command line or from panels.ini + * (value of other_dir). mc_run_param1 will be used for the right panel */ other_dir = mc_run_param1; } else @@ -589,8 +592,21 @@ create_panels (void) other_index = 0; current_mode = startup_right_mode; other_mode = startup_left_mode; - current_dir = mc_run_param1; - other_dir = mc_run_param0; + + /* if mc_run_param0 is not NULL (it was setup from command line), it will be used + * for the left panel, working directory will be used for the right one; + * if mc_run_param0 is NULL, working directory will be used for the right (active) panel, + * mc_run_param1 will be used for the left one */ + if (mc_run_param0 != NULL) + { + current_dir = NULL; + other_dir = mc_run_param0; + } + else + { + current_dir = NULL; + other_dir = mc_run_param1; + } } /* 1. Get current dir */ @@ -609,7 +625,10 @@ create_panels (void) /* 3. Create active panel */ if (current_dir == NULL) + { + current_dir = vfs_path_to_str (original_dir); mc_chdir (original_dir); + } else { vfs_path_t *vpath; diff --git a/src/setup.c b/src/setup.c index 791a2bc84..2b6c9bf74 100644 --- a/src/setup.c +++ b/src/setup.c @@ -799,8 +799,7 @@ save_panel_types (void) } if (current_panel != NULL) - mc_config_set_string (mc_panels_config, "Dirs", "current_is_left", - get_current_index () == 0 ? "1" : "0"); + mc_config_set_bool (mc_panels_config, "Dirs", "current_is_left", get_current_index () == 0); if (mc_panels_config->ini_path == NULL) mc_panels_config->ini_path = g_strdup (panels_profile_name);