diff --git a/src/main.c b/src/main.c index 19d0b930c..e8e5c2077 100644 --- a/src/main.c +++ b/src/main.c @@ -1123,26 +1123,35 @@ create_panels (void) static void copy_current_pathname (void) { + char *cwd_path; if (!command_prompt) return; - command_insert (cmdline, current_panel->cwd, 0); - if (current_panel->cwd[strlen (current_panel->cwd) - 1] != PATH_SEP) + cwd_path = remove_encoding_from_path (current_panel->cwd); + command_insert (cmdline, cwd_path, 0); + + if (cwd_path [strlen (cwd_path ) - 1] != PATH_SEP) command_insert (cmdline, PATH_SEP_STR, 0); + g_free (cwd_path); } static void copy_other_pathname (void) { + char *cwd_path; + if (get_other_type () != view_listing) return; if (!command_prompt) return; - command_insert (cmdline, other_panel->cwd, 0); - if (other_panel->cwd[strlen (other_panel->cwd) - 1] != PATH_SEP) + cwd_path = remove_encoding_from_path (other_panel->cwd); + command_insert (cmdline, cwd_path, 0); + + if (cwd_path [strlen (cwd_path ) - 1] != PATH_SEP) command_insert (cmdline, PATH_SEP_STR, 0); + g_free (cwd_path); } static void diff --git a/src/main.h b/src/main.h index 3895f4583..d6afacb89 100644 --- a/src/main.h +++ b/src/main.h @@ -130,6 +130,8 @@ void do_possible_cd (const char *dir); void done_menu (void); void init_menu (void); +char *remove_encoding_from_path (const char *); + #define MC_BASE "/.mc/" void directory_history_add (struct WPanel *panel, const char *dir); diff --git a/src/screen.c b/src/screen.c index 76ba3d07c..88f310bc2 100644 --- a/src/screen.c +++ b/src/screen.c @@ -905,7 +905,7 @@ static char return result; } -static char * +char * remove_encoding_from_path (const char *path) { GString *ret;