Hi,
I'm sending a patch which adds the 'Ignore', 'Ignore all', 'Ignore similar'
buttons to error message window.
Description
---
The error message window shows some more buttons:
'Ignore all' - ignore all following errors
'Ignore similar' - ignore "this" specific error;
"this" is based on error message displayed and
is by now (can be easily enhanced to another)
- 'cannot remove directory'
- 'cannot chown file'
- 'cannot cmmod file'
- 'cannot stat file'
This button is not shown for other errors.
'Ignore' - this is just renamed 'Skip' button, which now seems to
be more logical with conjunction with names of other buttons
If error concerns only one file, the buttons 'Ignore all/similar' are
not shown.
Code changes
In order to make no substantial changes to code handling the return
codes form file_error, all error ignoring was put into file_error,
do_file_error and real_file_error.
So these functions now take the context and a flag indicating specific
error to ignore.
Ignored flags are stored in context.
Things to discuss & possible enhancements
-
Names of buttons - I hope the meaning and difference between
'all' and 'similar' is clear. Maybe someone will find better.
Order of buttons - Maybe, 'similar' should go before 'all'.
Position of buttons - The query dialog puts all buttons into
one line and with all these buttons, the window gets very wide
(nearly full 80 columns). Breaking button line into more lines
can be nice, but is not necessary now.
More buttons - More special decisions about places of show/not show errors.
'Only this directory' - don't show error only in this dir
'This dir. and subdirs' - --"-- and subdirs too
More specific errors to ignore -
- file operations: delete, open, create
- various symlink errors
- etc
Adding a new error to ignore is easy:
1. add a constant FILE_x into fileopctx.h
2. search through file.c and give this constant as a parameter to
right file_error calls
David
Binary files mc/src/cons.saver and mc-ignore/src/cons.saver differ
diff -X .diffignore -urNp mc/src/file.c mc-ignore/src/file.c
--- mc/src/file.c Fri Jun 6 20:17:53 2003
+++ mc-ignore/src/file.c Tue Jun 10 16:13:15 2003
@@ -147,7 +147,7 @@ char *op_names[3] = {
static int query_replace (FileOpContext * ctx, char *destname,
struct stat *_s_stat, struct stat *_d_stat);
static int query_recursive (FileOpContext * ctx, char *s);
-static int do_file_error (char *str);
+static int do_file_error (FileOpContext * ctx, FileErrorIgnoreSet ign, char *str);
enum CaseConvs { NO_CONV = 0, UP_CHAR = 1, LOW_CHAR = 2, UP_SECT =
@@ -369,7 +369,8 @@ make_symlink (FileOpContext *ctx, char *
len = mc_readlink (src_path, link_target, MC_MAXPATHLEN);
if (len < 0) {
return_status =
- file_error (_(" Cannot read source link \"%s\" \n %s "),
+ file_error (ctx, IGN_NONE,
+ _(" Cannot read source link \"%s\" \n %s "),
src_path);
if (return_status == FILE_RETRY)
goto retry_src_readlink;
@@ -429,7 +430,8 @@ make_symlink (FileOpContext *ctx, char *
return FILE_CONT;
}
return_status =
- file_error (_(" Cannot create target symlink \"%s\" \n %s "),
+ file_error (ctx, IGN_NONE,
+ _(" Cannot create target symlink \"%s\" \n %s "),
dst_path);
if (return_status == FILE_RETRY)
goto retry_dst_symlink;
@@ -504,7 +506,8 @@ copy_file_file (FileOpContext *ctx, char
if (mc_stat (dst_path, &sb2) == 0) {
if (S_ISDIR (sb2.st_mode)) {
return_status =
- file_error (_(" Cannot overwrite directory \"%s\" \n %s "),
+ file_error (ctx, IGN_NONE,
+ _(" Cannot overwrite directory \"%s\" \n %s "),
dst_path);
if (return_status == FILE_RETRY)
goto retry_dst_stat;
@@ -515,7 +518,8 @@ copy_file_file (FileOpContext *ctx, char
while ((*ctx->stat_func) (src_path, &sb)) {
return_status =
- file_error (_(" Cannot stat source file \"%s\" \n %s "),
+ file_error (ctx, IGN_STAT,
+ _(" Cannot stat source file \"%s\" \n %s "),
src_path);
if (return_status != FILE_RETRY)
return return_status;
@@ -570,8 +574,8 @@ copy_file_file (FileOpContext *ctx, char
(dst_path, sb.st_mode & ctx->umask_kill,
sb.st_rdev) < 0) {
return_status =
- file_error (_
-(" Cannot create special file \"%s\" \n %s "),
+ file_error (ctx, IGN_NONE,
+_(" Cannot create special file \"%s\" \n %s "),
dst_path);
if (return_status == FILE_RETRY)
continue;
@@ -583,8 +587,8 @@ copy_file_file (FileOpContext *ctx, char
while (ctx->preserve_uidgid
&& mc_chown (dst_path, sb.st_uid, sb.st_gid)) {
temp_status =
- file_error (_
-(" Cannot chown target file \"%s\" \n %s "),
+ file_error (ctx, IGN_CHOWN,
+_(" Cannot chown target file \"%s\" \n %s "),
dst_path);
if (temp_status == FILE_RETRY)
continue;