mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-23 04:46:55 +03:00
(cd_error_msg): new function to show the change directory error message.
Use it where needed. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
8cc71a7f65
commit
f4ac2bb01f
@ -38,6 +38,7 @@
|
||||
#include "lib/vfs/vfs.h"
|
||||
#include "lib/strescape.h" /* strutils_shell_unescape() */
|
||||
#include "lib/util.h" /* whitespace() */
|
||||
#include "lib/widget.h" /* message() */
|
||||
|
||||
#include "filemanager.h" /* current_panel, panel.h, layout.h */
|
||||
#include "tree.h" /* sync_tree() */
|
||||
@ -286,8 +287,7 @@ cd_to (const char *path)
|
||||
char *d;
|
||||
|
||||
d = vfs_path_to_str_flags (q_vpath, 0, VPF_STRIP_PASSWORD);
|
||||
message (D_ERROR, MSG_ERROR, _("Cannot chdir to \"%s\"\n%s"), d,
|
||||
unix_error_string (errno));
|
||||
cd_error_message (d);
|
||||
g_free (d);
|
||||
}
|
||||
|
||||
@ -299,3 +299,12 @@ cd_to (const char *path)
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
cd_error_message (const char *path)
|
||||
{
|
||||
message (D_ERROR, MSG_ERROR, _("Cannot change directory to\n%s\n%s"), path,
|
||||
unix_error_string (errno));
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
@ -16,6 +16,7 @@
|
||||
/*** declarations of public functions ************************************************************/
|
||||
|
||||
void cd_to (const char *path);
|
||||
void cd_error_message (const char *path);
|
||||
|
||||
/*** inline functions ****************************************************************************/
|
||||
|
||||
|
@ -90,7 +90,7 @@
|
||||
#include "ext.h" /* regex_command() */
|
||||
#include "boxes.h" /* cd_box() */
|
||||
#include "dir.h"
|
||||
#include "cd.h" /* cd_to() */
|
||||
#include "cd.h"
|
||||
|
||||
#include "cmd.h" /* Our definitions */
|
||||
|
||||
@ -147,7 +147,7 @@ do_view_cmd (WPanel * panel, gboolean plain_view)
|
||||
|
||||
fname_vpath = vfs_path_from_str (fe->fname->str);
|
||||
if (!panel_cd (panel, fname_vpath, cd_exact))
|
||||
message (D_ERROR, MSG_ERROR, _("Cannot change directory"));
|
||||
cd_error_message (fe->fname->str);
|
||||
vfs_path_free (fname_vpath, TRUE);
|
||||
}
|
||||
else
|
||||
@ -446,7 +446,7 @@ nice_cd (const char *text, const char *xtext, const char *help,
|
||||
cd_vpath = vfs_path_from_str_flags (cd_path, VPF_NO_CANON);
|
||||
if (!panel_do_cd (MENU_PANEL, cd_vpath, cd_parse_command))
|
||||
{
|
||||
message (D_ERROR, MSG_ERROR, _("Cannot chdir to \"%s\""), cd_path);
|
||||
cd_error_message (cd_path);
|
||||
|
||||
if (save_type != view_listing)
|
||||
create_panel (MENU_PANEL_IDX, save_type);
|
||||
@ -1009,7 +1009,7 @@ vfs_list (WPanel * panel)
|
||||
|
||||
target_vpath = vfs_path_from_str (target);
|
||||
if (!panel_cd (current_panel, target_vpath, cd_exact))
|
||||
message (D_ERROR, MSG_ERROR, _("Cannot change directory"));
|
||||
cd_error_message (target);
|
||||
vfs_path_free (target_vpath, TRUE);
|
||||
g_free (target);
|
||||
}
|
||||
|
@ -32,7 +32,6 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -77,6 +76,7 @@
|
||||
#include "command.h" /* cmdline */
|
||||
#include "filemanager.h"
|
||||
#include "mountlist.h" /* my_statfs */
|
||||
#include "cd.h" /* cd_error_message() */
|
||||
|
||||
#include "panel.h"
|
||||
|
||||
@ -2936,7 +2936,7 @@ do_enter_on_file_entry (WPanel * panel, file_entry_t * fe)
|
||||
|
||||
fname_vpath = vfs_path_from_str (fname);
|
||||
if (!panel_cd (panel, fname_vpath, cd_exact))
|
||||
message (D_ERROR, MSG_ERROR, _("Cannot change directory"));
|
||||
cd_error_message (fname);
|
||||
vfs_path_free (fname_vpath, TRUE);
|
||||
return TRUE;
|
||||
}
|
||||
@ -3519,7 +3519,7 @@ directory_history_list (WPanel * panel)
|
||||
if (ok)
|
||||
directory_history_add (panel, panel->cwd_vpath);
|
||||
else
|
||||
message (D_ERROR, MSG_ERROR, _("Cannot change directory"));
|
||||
cd_error_message (hd.text);
|
||||
vfs_path_free (s_vpath, TRUE);
|
||||
g_free (hd.text);
|
||||
}
|
||||
@ -3814,8 +3814,7 @@ panel_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *d
|
||||
char *cwd;
|
||||
|
||||
cwd = vfs_path_to_str_flags (panel->cwd_vpath, 0, VPF_STRIP_PASSWORD);
|
||||
message (D_ERROR, MSG_ERROR, _("Cannot chdir to \"%s\"\n%s"),
|
||||
cwd, unix_error_string (errno));
|
||||
cd_error_message (cwd);
|
||||
g_free (cwd);
|
||||
}
|
||||
else
|
||||
@ -4971,8 +4970,7 @@ panel_change_encoding (WPanel * panel)
|
||||
vfs_path_change_encoding (panel->cwd_vpath, encoding);
|
||||
|
||||
if (!panel_do_cd (panel, panel->cwd_vpath, cd_parse_command))
|
||||
message (D_ERROR, MSG_ERROR, _("Cannot chdir to \"%s\""),
|
||||
vfs_path_as_str (panel->cwd_vpath));
|
||||
cd_error_message (vfs_path_as_str (panel->cwd_vpath));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -66,6 +66,7 @@
|
||||
#include "treestore.h"
|
||||
#include "cmd.h"
|
||||
#include "filegui.h"
|
||||
#include "cd.h" /* cd_error_message() */
|
||||
|
||||
#include "tree.h"
|
||||
|
||||
@ -593,8 +594,7 @@ tree_chdir_sel (WTree * tree)
|
||||
if (panel_cd (p, tree->selected_ptr->name, cd_exact))
|
||||
select_item (p);
|
||||
else
|
||||
message (D_ERROR, MSG_ERROR, _("Cannot chdir to \"%s\"\n%s"),
|
||||
vfs_path_as_str (tree->selected_ptr->name), unix_error_string (errno));
|
||||
cd_error_message (vfs_path_as_str (tree->selected_ptr->name));
|
||||
|
||||
widget_draw (WIDGET (p));
|
||||
(void) change_panel ();
|
||||
|
Loading…
Reference in New Issue
Block a user