From c5fd73d92bc874e5c4142f0034d52c8112885d81 Mon Sep 17 00:00:00 2001 From: "Andrew V. Samoilov" Date: Tue, 21 Sep 2004 12:40:50 +0000 Subject: [PATCH] * filegui.c (file_mask_dialog): Expand tilde. Remove redundant ifs before g_free(). --- src/ChangeLog | 7 ++++++- src/filegui.c | 16 +++++++++------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 1ae70edd3..0da77a0db 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2004-09-21 Leonard den Ottolander + + * filegui.c (file_mask_dialog): Expand tilde. Remove redundant + ifs before g_free(). + 2004-09-19 Roland Illig * achown.c: Added const qualifiers and const_cast. @@ -67,7 +72,7 @@ * wtools.h (QuickWidget): Make text const. * wtools.c (fg_input_dialog_help): Fix warning. -2004-09-14 Leonard den Ottolander + * utilunix.c (tilde_expand): Fix extra slash in result from tilde_expand() for ~/dir. diff --git a/src/filegui.c b/src/filegui.c index e7661d1fd..c6078966b 100644 --- a/src/filegui.c +++ b/src/filegui.c @@ -852,7 +852,7 @@ file_mask_dialog (FileOpContext *ctx, FileOperation operation, const char *text, const char *def_text, int only_one, int *do_background) { int source_easy_patterns = easy_patterns; - char *source_mask, *orig_mask, *dest_dir; + char *source_mask, *orig_mask, *dest_dir, *tmpdest; const char *error; struct stat buf; int val; @@ -914,8 +914,7 @@ file_mask_dialog (FileOpContext *ctx, FileOperation operation, const char *text, orig_mask = source_mask; if (!dest_dir || !*dest_dir) { - if (source_mask) - g_free (source_mask); + g_free (source_mask); return dest_dir; } if (source_easy_patterns) { @@ -935,12 +934,15 @@ file_mask_dialog (FileOpContext *ctx, FileOperation operation, const char *text, if (error) { message (1, MSG_ERROR, _("Invalid source pattern `%s' \n %s "), orig_mask, error); - if (orig_mask) - g_free (orig_mask); + g_free (orig_mask); goto ask_file_mask; } - if (orig_mask) - g_free (orig_mask); + g_free (orig_mask); + + tmpdest = dest_dir; + dest_dir = tilde_expand(tmpdest); + g_free(tmpdest); + ctx->dest_mask = strrchr (dest_dir, PATH_SEP); if (ctx->dest_mask == NULL) ctx->dest_mask = dest_dir;