mirror of https://github.com/MidnightCommander/mc
Merge branch '2493_file_operation_regexp_error'
* 2493_file_operation_regexp_error: Ticket #2493: handle regexp errors in file operation.
This commit is contained in:
commit
d26466c898
|
@ -2,7 +2,7 @@
|
||||||
File management.
|
File management.
|
||||||
|
|
||||||
Copyright (C) 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003,
|
Copyright (C) 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003,
|
||||||
2004, 2005, 2006, 2007, 2011
|
2004, 2005, 2006, 2007, 2011, 2012, 2013
|
||||||
The Free Software Foundation, Inc.
|
The Free Software Foundation, Inc.
|
||||||
|
|
||||||
Written by:
|
Written by:
|
||||||
|
@ -12,6 +12,7 @@
|
||||||
Jakub Jelinek, 1995, 1996
|
Jakub Jelinek, 1995, 1996
|
||||||
Norbert Warmuth, 1997
|
Norbert Warmuth, 1997
|
||||||
Pavel Machek, 1998
|
Pavel Machek, 1998
|
||||||
|
Andrew Borodin <aborodin@vmail.ru>, 2011, 2012, 2013
|
||||||
|
|
||||||
The copy code was based in GNU's cp, and was written by:
|
The copy code was based in GNU's cp, and was written by:
|
||||||
Torbjorn Granlund, David MacKenzie, and Jim Meyering.
|
Torbjorn Granlund, David MacKenzie, and Jim Meyering.
|
||||||
|
@ -212,7 +213,15 @@ transform_source (FileOpContext * ctx, const char *source)
|
||||||
fnsource = (char *) x_basename (s);
|
fnsource = (char *) x_basename (s);
|
||||||
|
|
||||||
if (mc_search_run (ctx->search_handle, fnsource, 0, strlen (fnsource), NULL))
|
if (mc_search_run (ctx->search_handle, fnsource, 0, strlen (fnsource), NULL))
|
||||||
|
{
|
||||||
q = mc_search_prepare_replace_str2 (ctx->search_handle, ctx->dest_mask);
|
q = mc_search_prepare_replace_str2 (ctx->search_handle, ctx->dest_mask);
|
||||||
|
if (ctx->search_handle->error != MC_SEARCH_E_OK)
|
||||||
|
{
|
||||||
|
message (D_ERROR, MSG_ERROR, "%s", ctx->search_handle->error_str);
|
||||||
|
q = NULL;
|
||||||
|
transform_error = FILE_ABORT;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
q = NULL;
|
q = NULL;
|
||||||
|
@ -2873,6 +2882,13 @@ panel_operate (void *source_panel, FileOperation operation, gboolean force_singl
|
||||||
char *repl_dest, *temp2;
|
char *repl_dest, *temp2;
|
||||||
|
|
||||||
repl_dest = mc_search_prepare_replace_str2 (ctx->search_handle, dest);
|
repl_dest = mc_search_prepare_replace_str2 (ctx->search_handle, dest);
|
||||||
|
if (ctx->search_handle->error != MC_SEARCH_E_OK)
|
||||||
|
{
|
||||||
|
message (D_ERROR, MSG_ERROR, "%s", ctx->search_handle->error_str);
|
||||||
|
g_free (repl_dest);
|
||||||
|
goto clean_up;
|
||||||
|
}
|
||||||
|
|
||||||
temp2 = mc_build_filename (repl_dest, temp, NULL);
|
temp2 = mc_build_filename (repl_dest, temp, NULL);
|
||||||
g_free (temp);
|
g_free (temp);
|
||||||
g_free (repl_dest);
|
g_free (repl_dest);
|
||||||
|
@ -2966,7 +2982,6 @@ panel_operate (void *source_panel, FileOperation operation, gboolean force_singl
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
temp = transform_source (ctx, source_with_path_str);
|
temp = transform_source (ctx, source_with_path_str);
|
||||||
|
|
||||||
if (temp == NULL)
|
if (temp == NULL)
|
||||||
value = transform_error;
|
value = transform_error;
|
||||||
else
|
else
|
||||||
|
@ -2974,6 +2989,13 @@ panel_operate (void *source_panel, FileOperation operation, gboolean force_singl
|
||||||
char *temp2, *temp3, *repl_dest;
|
char *temp2, *temp3, *repl_dest;
|
||||||
|
|
||||||
repl_dest = mc_search_prepare_replace_str2 (ctx->search_handle, dest);
|
repl_dest = mc_search_prepare_replace_str2 (ctx->search_handle, dest);
|
||||||
|
if (ctx->search_handle->error != MC_SEARCH_E_OK)
|
||||||
|
{
|
||||||
|
message (D_ERROR, MSG_ERROR, "%s", ctx->search_handle->error_str);
|
||||||
|
g_free (repl_dest);
|
||||||
|
goto clean_up;
|
||||||
|
}
|
||||||
|
|
||||||
temp2 = mc_build_filename (repl_dest, temp, NULL);
|
temp2 = mc_build_filename (repl_dest, temp, NULL);
|
||||||
g_free (temp);
|
g_free (temp);
|
||||||
g_free (repl_dest);
|
g_free (repl_dest);
|
||||||
|
|
Loading…
Reference in New Issue