From 28f01343816e6dd69a80f36947b0ea4297462550 Mon Sep 17 00:00:00 2001 From: sc0w Date: Sat, 21 May 2016 23:03:39 +0200 Subject: 7z: Fixed problems with files prefixed '@' Fixes #138 --- src/fr-command-7z.c | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/src/fr-command-7z.c b/src/fr-command-7z.c index 316df11..20cfa2c 100644 --- a/src/fr-command-7z.c +++ b/src/fr-command-7z.c @@ -371,11 +371,20 @@ fr_command_7z_add (FrCommand *comm, if (from_file != NULL) fr_process_add_arg_concat (comm->process, "-i@", from_file, NULL); + if (from_file == NULL) + for (scan = file_list; scan; scan = scan->next) + /* Files prefixed with '@' need to be handled specially */ + if (g_str_has_prefix (scan->data, "@")) + fr_process_add_arg_concat (comm->process, "-i!", scan->data, NULL); + fr_process_add_arg (comm->process, "--"); fr_process_add_arg (comm->process, comm->filename); + if (from_file == NULL) for (scan = file_list; scan; scan = scan->next) - fr_process_add_arg (comm->process, scan->data); + /* Skip files prefixed with '@', already added */ + if (!g_str_has_prefix (scan->data, "@")) + fr_process_add_arg (comm->process, scan->data); fr_process_end_command (comm->process); } @@ -399,11 +408,20 @@ fr_command_7z_delete (FrCommand *comm, if (from_file != NULL) fr_process_add_arg_concat (comm->process, "-i@", from_file, NULL); + if (from_file == NULL) + for (scan = file_list; scan; scan = scan->next) + /* Files prefixed with '@' need to be handled specially */ + if (g_str_has_prefix (scan->data, "@")) + fr_process_add_arg_concat (comm->process, "-i!", scan->data, NULL); + fr_process_add_arg (comm->process, "--"); fr_process_add_arg (comm->process, comm->filename); + if (from_file == NULL) for (scan = file_list; scan; scan = scan->next) - fr_process_add_arg (comm->process, scan->data); + /* Skip files prefixed with '@', already added */ + if (!g_str_has_prefix (scan->data, "@")) + fr_process_add_arg (comm->process, scan->data); fr_process_end_command (comm->process); } @@ -453,11 +471,20 @@ fr_command_7z_extract (FrCommand *comm, if (from_file != NULL) fr_process_add_arg_concat (comm->process, "-i@", from_file, NULL); + if (from_file == NULL) + for (scan = file_list; scan; scan = scan->next) + /* Files prefixed with '@' need to be handled specially */ + if (g_str_has_prefix (scan->data, "@")) + fr_process_add_arg_concat (comm->process, "-i!", scan->data, NULL); + fr_process_add_arg (comm->process, "--"); fr_process_add_arg (comm->process, comm->filename); + if (from_file == NULL) for (scan = file_list; scan; scan = scan->next) - fr_process_add_arg (comm->process, scan->data); + /* Skip files prefixed with '@', already added */ + if (!g_str_has_prefix (scan->data, "@")) + fr_process_add_arg (comm->process, scan->data); fr_process_end_command (comm->process); } -- cgit v1.2.1