mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-23 04:46:55 +03:00
Ticket #1609: Do not modify file name in file operations.
Initial step: minor refactoring. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
551ca67e8f
commit
0cd390fd50
21
src/file.c
21
src/file.c
@ -150,26 +150,29 @@ static FileProgressStatus transform_error = FILE_CONT;
|
||||
static char *
|
||||
transform_source (FileOpContext *ctx, const char *source)
|
||||
{
|
||||
char *s = g_strdup (source);
|
||||
char *q;
|
||||
char *fnsource = (char*)x_basename (s);
|
||||
char *s, *q;
|
||||
char *fnsource;
|
||||
|
||||
s = g_strdup (source);
|
||||
|
||||
/* We remove \n from the filename since regex routines would use \n as an anchor */
|
||||
/* this is just to be allowed to maniupulate file names with \n on it */
|
||||
for (q = s; *q; q++) {
|
||||
for (q = s; *q != '\0'; q++)
|
||||
if (*q == '\n')
|
||||
*q = ' ';
|
||||
}
|
||||
|
||||
fnsource = (char *) x_basename (s);
|
||||
str_fix_string (fnsource);
|
||||
|
||||
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);
|
||||
else {
|
||||
q = NULL;
|
||||
transform_error = FILE_SKIP;
|
||||
g_free (s);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
g_free (s);
|
||||
return mc_search_prepare_replace_str2 (ctx->search_handle, ctx->dest_mask);
|
||||
return q;
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user