file-roller r2314 - in trunk: . src
- From: paobac svn gnome org
- To: svn-commits-list gnome org
- Subject: file-roller r2314 - in trunk: . src
- Date: Tue, 10 Jun 2008 17:04:20 +0000 (UTC)
Author: paobac
Date: Tue Jun 10 17:04:20 2008
New Revision: 2314
URL: http://svn.gnome.org/viewvc/file-roller?rev=2314&view=rev
Log:
2008-06-10 Paolo Bacchilega <paobac svn gnome org>
* src/main.c:
* src/glib-utils.h:
* src/glib-utils.c:
* src/fr-window.h:
* src/fr-window.c:
* src/fr-process.h:
* src/fr-process.c:
* src/fr-command-zoo.c:
* src/fr-command-zip.c:
* src/fr-command-unstuff.c:
* src/fr-command-tar.c:
* src/fr-command-rpm.c:
* src/fr-command-rar.c:
* src/fr-command-lha.c:
* src/fr-command-jar.c:
* src/fr-command-iso.c:
* src/fr-command-cpio.c:
* src/fr-command-cfile.c:
* src/fr-command-arj.c:
* src/fr-command-ar.c:
* src/fr-command-ace.c:
* src/fr-command-7z.c:
* src/fr-command.h:
* src/fr-command.c:
* src/fr-archive.h:
* src/fr-archive.c:
* src/dlg-prop.c:
* src/dlg-ask-password.c:
* src/dlg-add-folder.c:
Do not use the sh command to exec the process, use the utility command
directly to allow to stop the process properly (see #520844).
Do not escape the filenames because the shell is not used anymore.
Modified:
trunk/ChangeLog
trunk/TODO
trunk/src/dlg-add-folder.c
trunk/src/dlg-ask-password.c
trunk/src/dlg-prop.c
trunk/src/fr-archive.c
trunk/src/fr-archive.h
trunk/src/fr-command-7z.c
trunk/src/fr-command-ace.c
trunk/src/fr-command-ar.c
trunk/src/fr-command-arj.c
trunk/src/fr-command-cfile.c
trunk/src/fr-command-cpio.c
trunk/src/fr-command-iso.c
trunk/src/fr-command-jar.c
trunk/src/fr-command-lha.c
trunk/src/fr-command-rar.c
trunk/src/fr-command-rpm.c
trunk/src/fr-command-tar.c
trunk/src/fr-command-unstuff.c
trunk/src/fr-command-zip.c
trunk/src/fr-command-zoo.c
trunk/src/fr-command.c
trunk/src/fr-command.h
trunk/src/fr-process.c
trunk/src/fr-process.h
trunk/src/fr-window.c
trunk/src/fr-window.h
trunk/src/glib-utils.c
trunk/src/glib-utils.h
trunk/src/main.c
Modified: trunk/TODO
==============================================================================
--- trunk/TODO (original)
+++ trunk/TODO Tue Jun 10 17:04:20 2008
@@ -1,4 +1,3 @@
-
== ToDo ==
[ ] optimization of the add_folder operation: if the command supports all the
Modified: trunk/src/dlg-add-folder.c
==============================================================================
--- trunk/src/dlg-add-folder.c (original)
+++ trunk/src/dlg-add-folder.c Tue Jun 10 17:04:20 2008
@@ -181,7 +181,6 @@
folder,
dest_dir,
update,
- recursive,
follow_links);
g_free (dest_dir);
Modified: trunk/src/dlg-ask-password.c
==============================================================================
--- trunk/src/dlg-ask-password.c (original)
+++ trunk/src/dlg-ask-password.c Tue Jun 10 17:04:20 2008
@@ -26,6 +26,7 @@
#include <gtk/gtk.h>
#include <glade/glade.h>
#include "file-utils.h"
+#include "glib-utils.h"
#include "gtk-utils.h"
#include "fr-window.h"
@@ -117,9 +118,9 @@
/* Set widgets data. */
if (data->pwd_type == FR_PASSWORD_TYPE_MAIN)
- name = g_filename_display_basename (fr_window_get_archive_uri (window));
+ name = g_uri_display_basename (fr_window_get_archive_uri (window));
else if (data->pwd_type == FR_PASSWORD_TYPE_PASTE_FROM)
- name = g_filename_display_basename (fr_window_get_paste_archive_uri (window));
+ name = g_uri_display_basename (fr_window_get_paste_archive_uri (window));
text = g_strdup_printf (_("Enter the password for the archive '%s'."), name);
gtk_label_set_label (GTK_LABEL (label), text);
g_free (text);
Modified: trunk/src/dlg-prop.c
==============================================================================
--- trunk/src/dlg-prop.c (original)
+++ trunk/src/dlg-prop.c Tue Jun 10 17:04:20 2008
@@ -122,7 +122,7 @@
set_label (label_label, _("Name:"));
label = glade_xml_get_widget (data->gui, "p_name_label");
- utf8_name = g_filename_display_basename (fr_window_get_archive_uri (window));
+ utf8_name = g_uri_display_basename (fr_window_get_archive_uri (window));
gtk_label_set_text (GTK_LABEL (label), utf8_name);
title_txt = g_strdup_printf (_("%s Properties"), utf8_name);
Modified: trunk/src/fr-archive.c
==============================================================================
--- trunk/src/fr-archive.c (original)
+++ trunk/src/fr-archive.c Tue Jun 10 17:04:20 2008
@@ -1249,40 +1249,6 @@
static void archive_remove (FrArchive *archive, GList *file_list);
-static GList *
-escape_file_list (FrCommand *command,
- GList *file_list)
-{
- GList *e_file_list = NULL;
- GList *scan;
-
- for (scan = file_list; scan; scan = scan->next) {
- char *filename = scan->data;
- char *escape = fr_command_escape (command, filename);
- e_file_list = g_list_prepend (e_file_list, escape);
- }
-
- return e_file_list;
-}
-
-
-static GList *
-shell_escape_file_list (FrCommand *command,
- GList *file_list)
-{
- GList *e_file_list = NULL;
- GList *scan;
-
- for (scan = file_list; scan; scan = scan->next) {
- char *filename = scan->data;
- char *escape = shell_escape (filename);
- e_file_list = g_list_prepend (e_file_list, escape);
- }
-
- return e_file_list;
-}
-
-
/* Note: all paths unescaped. */
static GList *
newer_files_only (FrArchive *archive,
@@ -1359,12 +1325,12 @@
const char *base_dir,
const char *dest_dir,
gboolean update,
+ gboolean recursive,
const char *password,
FrCompression compression)
{
GList *new_file_list = NULL;
gboolean base_dir_created = FALSE;
- GList *e_file_list;
GList *scan;
char *tmp_base_dir = NULL;
@@ -1452,11 +1418,9 @@
}
/* add now. */
+ fr_command_set_n_files (archive->command, g_list_length (new_file_list));
- e_file_list = shell_escape_file_list (archive->command, new_file_list);
- fr_command_set_n_files (archive->command, g_list_length (e_file_list));
-
- for (scan = e_file_list; scan != NULL; ) {
+ for (scan = new_file_list; scan != NULL; ) {
GList *prev = scan->prev;
GList *chunk_list;
int l;
@@ -1477,12 +1441,12 @@
chunk_list,
tmp_base_dir,
update,
+ recursive,
password,
compression);
prev->next = scan;
}
- path_list_free (e_file_list);
path_list_free (new_file_list);
fr_command_recompress (archive->command, compression);
@@ -1517,6 +1481,7 @@
base_dir,
dest_dir,
update,
+ FALSE,
password,
compression);
fr_process_start (archive->process);
@@ -1758,7 +1723,6 @@
const char *source_dir,
const char *dest_dir,
gboolean update,
- gboolean recursive,
gboolean follow_links,
const char *password,
FrCompression compression)
@@ -1782,7 +1746,7 @@
g_directory_list_async (source_dir,
source_dir,
- recursive,
+ TRUE,
follow_links,
NO_BACKUP_FILES,
NO_DOT_FILES,
@@ -2078,14 +2042,15 @@
GList *singleton;
basedir = remove_level_from_path (fullpath);
- singleton = g_list_prepend (NULL, shell_escape (file_name_from_path (fullpath)));
+ singleton = g_list_prepend (NULL, (char*)file_name_from_path (fullpath));
fr_command_add (archive->command,
singleton,
basedir,
data->update,
+ FALSE,
data->password,
data->compression);
- path_list_free (singleton);
+ g_list_free (singleton);
g_free (basedir);
}
fr_command_recompress (archive->command, data->compression);
@@ -2184,7 +2149,6 @@
gboolean file_list_created = FALSE;
GList *tmp_file_list = NULL;
gboolean tmp_file_list_created = FALSE;
- GList *e_file_list;
GList *scan;
/* file_list == NULL means delete all the files in the archive. */
@@ -2233,14 +2197,8 @@
if (file_list_created)
g_list_free (file_list);
- /* shell-escape the file list, and split in chunks to avoid
- * command line overflow */
-
- e_file_list = escape_file_list (archive->command, tmp_file_list);
- g_list_free (tmp_file_list);
-
- fr_command_set_n_files (archive->command, g_list_length (e_file_list));
- for (scan = e_file_list; scan != NULL; ) {
+ fr_command_set_n_files (archive->command, g_list_length (tmp_file_list));
+ for (scan = tmp_file_list; scan != NULL; ) {
GList *prev = scan->prev;
GList *chunk_list;
int l;
@@ -2260,7 +2218,7 @@
fr_command_delete (archive->command, chunk_list);
prev->next = scan;
}
- path_list_free (e_file_list);
+ g_list_free (tmp_file_list);
}
@@ -2298,17 +2256,11 @@
fr_process_begin_command (archive->process, "mv");
fr_process_add_arg (archive->process, "-f");
for (scan = file_list; scan; scan = scan->next) {
- char path[4096]; /* FIXME : 4096 ? */
- char *e_filename = shell_escape (scan->data);
-
- if (e_filename[0] == '/')
- sprintf (path, "%s%s", source_dir, e_filename);
+ char *filename = scan->data;
+ if (filename[0] == '/')
+ fr_process_add_arg_concat (archive->process, source_dir, filename, NULL);
else
- sprintf (path, "%s/%s", source_dir, e_filename);
-
- fr_process_add_arg (archive->process, path);
-
- g_free (e_filename);
+ fr_process_add_arg_concat (archive->process, source_dir, "/", filename, NULL);
}
fr_process_add_arg (archive->process, dest_dir);
fr_process_end_command (archive->process);
@@ -2323,13 +2275,9 @@
const char *dest_dir)
{
GList *scan;
- int e_temp_dir_l;
- char *e_temp_dir;
- char *e_dest_dir;
-
- e_temp_dir = shell_escape (temp_dir);
- e_dest_dir = shell_escape (dest_dir);
- e_temp_dir_l = strlen (e_temp_dir);
+ int temp_dir_l;
+
+ temp_dir_l = strlen (temp_dir);
for (scan = file_list; scan != NULL; ) {
GList *prev = scan->prev;
@@ -2340,23 +2288,17 @@
l = 0;
while ((scan != NULL) && (l < MAX_CHUNK_LEN)) {
if (l == 0)
- l = e_temp_dir_l + 1 + strlen (scan->data);
+ l = temp_dir_l + 1 + strlen (scan->data);
prev = scan;
scan = scan->next;
if (scan != NULL)
- l += e_temp_dir_l + 1 + strlen (scan->data);
+ l += temp_dir_l + 1 + strlen (scan->data);
}
prev->next = NULL;
- move_files_to_dir (archive,
- chunk_list,
- e_temp_dir,
- e_dest_dir);
+ move_files_to_dir (archive, chunk_list, temp_dir, dest_dir);
prev->next = scan;
}
-
- g_free (e_temp_dir);
- g_free (e_dest_dir);
}
@@ -2568,7 +2510,7 @@
gboolean junk_paths,
const char *password)
{
- GList *filtered, *e_filtered;
+ GList *filtered;
GList *scan;
gboolean extract_all;
gboolean use_base_dir;
@@ -2629,17 +2571,14 @@
else
filtered = file_list;
- if (! (created_filtered_list && (filtered == NULL))) {
- e_filtered = escape_file_list (archive->command, filtered);
+ if (! (created_filtered_list && (filtered == NULL)))
extract_in_chunks (archive->command,
- e_filtered,
+ filtered,
destination,
overwrite,
skip_older,
junk_paths,
password);
- path_list_free (e_filtered);
- }
if (created_filtered_list && (filtered != NULL))
g_list_free (filtered);
@@ -2725,15 +2664,12 @@
return;
}
- e_filtered = escape_file_list (archive->command, filtered);
-
if (move_to_dest_dir) {
char *temp_dir;
- char *e_temp_dir;
temp_dir = get_temp_work_dir ();
extract_in_chunks (archive->command,
- e_filtered,
+ filtered,
temp_dir,
overwrite,
skip_older,
@@ -2753,25 +2689,22 @@
/* remove the temp dir. */
- e_temp_dir = shell_escape (temp_dir);
fr_process_begin_command (archive->process, "rm");
fr_process_add_arg (archive->process, "-rf");
- fr_process_add_arg (archive->process, e_temp_dir);
+ fr_process_add_arg (archive->process, temp_dir);
fr_process_end_command (archive->process);
- g_free (e_temp_dir);
g_free (temp_dir);
}
else
extract_in_chunks (archive->command,
- e_filtered,
+ filtered,
destination,
overwrite,
skip_older,
junk_paths,
password);
- path_list_free (e_filtered);
if (filtered != NULL)
g_list_free (filtered);
if (file_list_created)
Modified: trunk/src/fr-archive.h
==============================================================================
--- trunk/src/fr-archive.h (original)
+++ trunk/src/fr-archive.h Tue Jun 10 17:04:20 2008
@@ -125,6 +125,7 @@
const char *base_dir,
const char *dest_dir,
gboolean update,
+ gboolean recursive,
const char *password,
FrCompression compression);
void fr_archive_remove (FrArchive *archive,
@@ -168,8 +169,7 @@
const char *exclude_folders,
const char *base_dir,
const char *dest_dir,
- gboolean update,
- gboolean recursive,
+ gboolean update,
gboolean follow_links,
const char *password,
FrCompression compression);
Modified: trunk/src/fr-command-7z.c
==============================================================================
--- trunk/src/fr-command-7z.c (original)
+++ trunk/src/fr-command-7z.c Tue Jun 10 17:04:20 2008
@@ -217,7 +217,7 @@
fr_process_add_arg (comm->process, "-bd");
fr_process_add_arg (comm->process, "-y");
add_password_arg (comm, password, FALSE);
- fr_process_add_arg (comm->process, comm->e_filename);
+ fr_process_add_arg (comm->process, comm->filename);
fr_process_end_command (comm->process);
fr_process_start (comm->process);
}
@@ -228,6 +228,7 @@
GList *file_list,
const char *base_dir,
gboolean update,
+ gboolean recursive,
const char *password,
FrCompression compression)
{
@@ -236,11 +237,8 @@
fr_command_7z_begin_command (comm);
if (base_dir != NULL) {
- char *working_dir;
fr_process_set_working_dir (comm->process, base_dir);
- working_dir = g_strconcat ("-w", base_dir, NULL);
- fr_process_add_arg (comm->process, working_dir);
- g_free (working_dir);
+ fr_process_add_arg_concat (comm->process, "-w", base_dir, NULL);
}
if (update)
@@ -264,7 +262,7 @@
fr_process_add_arg (comm->process, "-mx=7"); break;
}
- fr_process_add_arg (comm->process, comm->e_filename);
+ fr_process_add_arg (comm->process, comm->filename);
for (scan = file_list; scan; scan = scan->next) {
char *filename = scan->data;
@@ -286,12 +284,10 @@
fr_process_add_arg (comm->process, "-bd");
fr_process_add_arg (comm->process, "-y");
- fr_process_add_arg (comm->process, comm->e_filename);
+ fr_process_add_arg (comm->process, comm->filename);
- for (scan = file_list; scan; scan = scan->next) {
- char *filename = scan->data;
- fr_process_add_arg (comm->process, filename);
- }
+ for (scan = file_list; scan; scan = scan->next)
+ fr_process_add_arg (comm->process, scan->data);
fr_process_end_command (comm->process);
}
@@ -319,20 +315,13 @@
fr_process_add_arg (comm->process, "-y");
add_password_arg (comm, password, FALSE);
- if (dest_dir != NULL) {
- char *e_dest_dir = fr_command_escape (comm, dest_dir);
- char *opt = g_strconcat ("-o", e_dest_dir, NULL);
- fr_process_add_arg (comm->process, opt);
- g_free (opt);
- g_free (e_dest_dir);
- }
+ if (dest_dir != NULL)
+ fr_process_add_arg_concat (comm->process, "-o", dest_dir, NULL);
- fr_process_add_arg (comm->process, comm->e_filename);
+ fr_process_add_arg (comm->process, comm->filename);
- for (scan = file_list; scan; scan = scan->next) {
- char *filename = scan->data;
- fr_process_add_arg (comm->process, filename);
- }
+ for (scan = file_list; scan; scan = scan->next)
+ fr_process_add_arg (comm->process, scan->data);
fr_process_end_command (comm->process);
}
@@ -347,7 +336,7 @@
fr_process_add_arg (comm->process, "-bd");
fr_process_add_arg (comm->process, "-y");
add_password_arg (comm, password, FALSE);
- fr_process_add_arg (comm->process, comm->e_filename);
+ fr_process_add_arg (comm->process, comm->filename);
fr_process_end_command (comm->process);
}
Modified: trunk/src/fr-command-ace.c
==============================================================================
--- trunk/src/fr-command-ace.c (original)
+++ trunk/src/fr-command-ace.c Tue Jun 10 17:04:20 2008
@@ -175,7 +175,7 @@
fr_process_begin_command (comm->process, "unace");
fr_process_add_arg (comm->process, "v");
fr_process_add_arg (comm->process, "-y");
- fr_process_add_arg (comm->process, comm->e_filename);
+ fr_process_add_arg (comm->process, comm->filename);
fr_process_end_command (comm->process);
fr_process_start (comm->process);
}
@@ -202,7 +202,7 @@
else
fr_process_add_arg (comm->process, "x");
fr_process_add_arg (comm->process, "-y");
- fr_process_add_arg (comm->process, comm->e_filename);
+ fr_process_add_arg (comm->process, comm->filename);
for (scan = file_list; scan; scan = scan->next)
fr_process_add_arg (comm->process, scan->data);
@@ -218,7 +218,7 @@
fr_process_begin_command (comm->process, "unace");
fr_process_add_arg (comm->process, "t");
fr_process_add_arg (comm->process, "-y");
- fr_process_add_arg (comm->process, comm->e_filename);
+ fr_process_add_arg (comm->process, comm->filename);
fr_process_end_command (comm->process);
}
Modified: trunk/src/fr-command-ar.c
==============================================================================
--- trunk/src/fr-command-ar.c (original)
+++ trunk/src/fr-command-ar.c Tue Jun 10 17:04:20 2008
@@ -197,7 +197,7 @@
fr_process_begin_command (comm->process, "ar");
fr_process_add_arg (comm->process, "tv");
- fr_process_add_arg (comm->process, comm->e_filename);
+ fr_process_add_arg (comm->process, comm->filename);
fr_process_end_command (comm->process);
fr_process_start (comm->process);
}
@@ -208,6 +208,7 @@
GList *file_list,
const char *base_dir,
gboolean update,
+ gboolean recursive,
const char *password,
FrCompression compression)
{
@@ -223,10 +224,10 @@
if (base_dir != NULL)
fr_process_set_working_dir (comm->process, base_dir);
- fr_process_add_arg (comm->process, comm->e_filename);
+ fr_process_add_arg (comm->process, comm->filename);
for (scan = file_list; scan; scan = scan->next)
- fr_process_add_arg (comm->process, (gchar*) scan->data);
+ fr_process_add_arg (comm->process, scan->data);
fr_process_end_command (comm->process);
}
@@ -240,9 +241,7 @@
fr_process_begin_command (comm->process, "ar");
fr_process_add_arg (comm->process, "d");
-
- fr_process_add_arg (comm->process, comm->e_filename);
-
+ fr_process_add_arg (comm->process, comm->filename);
for (scan = file_list; scan; scan = scan->next)
fr_process_add_arg (comm->process, scan->data);
fr_process_end_command (comm->process);
@@ -266,11 +265,9 @@
fr_process_set_working_dir (comm->process, dest_dir);
fr_process_add_arg (comm->process, "x");
- fr_process_add_arg (comm->process, comm->e_filename);
-
+ fr_process_add_arg (comm->process, comm->filename);
for (scan = file_list; scan; scan = scan->next)
fr_process_add_arg (comm->process, scan->data);
-
fr_process_end_command (comm->process);
}
Modified: trunk/src/fr-command-arj.c
==============================================================================
--- trunk/src/fr-command-arj.c (original)
+++ trunk/src/fr-command-arj.c Tue Jun 10 17:04:20 2008
@@ -171,7 +171,7 @@
fr_process_add_arg (comm->process, "v");
fr_process_add_arg (comm->process, "-y");
fr_process_add_arg (comm->process, "-");
- fr_process_add_arg (comm->process, comm->e_filename);
+ fr_process_add_arg (comm->process, comm->filename);
fr_process_end_command (comm->process);
fr_process_start (comm->process);
}
@@ -182,6 +182,7 @@
GList *file_list,
const char *base_dir,
gboolean update,
+ gboolean recursive,
const char *password,
FrCompression compression)
{
@@ -197,11 +198,8 @@
if (update)
fr_process_add_arg (comm->process, "-u");
- if (password != NULL) {
- char *swtch = g_strconcat ("-g/", password, NULL);
- fr_process_add_arg (comm->process, swtch);
- g_free (swtch);
- }
+ if (password != NULL)
+ fr_process_add_arg_concat (comm->process, "-g/", password, NULL);
switch (compression) {
case FR_COMPRESSION_VERY_FAST:
@@ -218,7 +216,7 @@
fr_process_add_arg (comm->process, "-y");
fr_process_add_arg (comm->process, "-");
- fr_process_add_arg (comm->process, comm->e_filename);
+ fr_process_add_arg (comm->process, comm->filename);
for (scan = file_list; scan; scan = scan->next)
fr_process_add_arg (comm->process, (gchar*) scan->data);
@@ -240,7 +238,7 @@
fr_process_add_arg (comm->process, "-y");
fr_process_add_arg (comm->process, "-");
- fr_process_add_arg (comm->process, comm->e_filename);
+ fr_process_add_arg (comm->process, comm->filename);
for (scan = file_list; scan; scan = scan->next)
fr_process_add_arg (comm->process, scan->data);
@@ -266,13 +264,8 @@
else
fr_process_add_arg (comm->process, "x");
- if (dest_dir != NULL) {
- char *e_dest_dir = fr_command_escape (comm, dest_dir);
- char *swtch = g_strconcat ("-ht/", e_dest_dir, NULL);
- fr_process_add_arg (comm->process, swtch);
- g_free (swtch);
- g_free (e_dest_dir);
- }
+ if (dest_dir != NULL)
+ fr_process_add_arg_concat (comm->process, "-ht/", dest_dir, NULL);
if (! overwrite)
fr_process_add_arg (comm->process, "-n");
@@ -280,18 +273,16 @@
if (skip_older)
fr_process_add_arg (comm->process, "-u");
- if (password != NULL) {
- char *swtch = g_strconcat ("-g/", password, NULL);
- fr_process_add_arg (comm->process, swtch);
- g_free (swtch);
- } else
+ if (password != NULL)
+ fr_process_add_arg_concat (comm->process, "-g/", password, NULL);
+ else
fr_process_add_arg (comm->process, "-g/");
fr_process_add_arg (comm->process, "-i");
fr_process_add_arg (comm->process, "-y");
fr_process_add_arg (comm->process, "-");
- fr_process_add_arg (comm->process, comm->e_filename);
+ fr_process_add_arg (comm->process, comm->filename);
for (scan = file_list; scan; scan = scan->next)
fr_process_add_arg (comm->process, scan->data);
@@ -306,15 +297,12 @@
{
fr_process_begin_command (comm->process, "arj");
fr_process_add_arg (comm->process, "t");
- if (password != NULL) {
- char *swtch = g_strconcat ("-g/", password, NULL);
- fr_process_add_arg (comm->process, swtch);
- g_free (swtch);
- }
+ if (password != NULL)
+ fr_process_add_arg_concat (comm->process, "-g/", password, NULL);
fr_process_add_arg (comm->process, "-i");
fr_process_add_arg (comm->process, "-y");
fr_process_add_arg (comm->process, "-");
- fr_process_add_arg (comm->process, comm->e_filename);
+ fr_process_add_arg (comm->process, comm->filename);
fr_process_end_command (comm->process);
}
Modified: trunk/src/fr-command-cfile.c
==============================================================================
--- trunk/src/fr-command-cfile.c (original)
+++ trunk/src/fr-command-cfile.c Tue Jun 10 17:04:20 2008
@@ -156,7 +156,7 @@
fr_process_begin_command (comm->process, "gzip");
fr_process_add_arg (comm->process, "-l");
fr_process_add_arg (comm->process, "-q");
- fr_process_add_arg (comm->process, comm->e_filename);
+ fr_process_add_arg (comm->process, comm->filename);
fr_process_end_command (comm->process);
fr_process_start (comm->process);
}
@@ -204,27 +204,22 @@
GList *file_list,
const char *base_dir,
gboolean update,
+ gboolean recursive,
const char *password,
FrCompression compression)
{
const char *filename;
char *temp_dir;
- char *e_temp_dir;
char *temp_file;
if ((file_list == NULL) || (file_list->data == NULL))
return;
- /* create a temp dir. */
-
- temp_dir = get_temp_work_dir ();
- e_temp_dir = fr_command_escape (comm, temp_dir);
-
/* copy file to the temp dir */
+ temp_dir = get_temp_work_dir ();
filename = file_list->data;
-
- temp_file = g_strconcat (e_temp_dir, "/", filename, NULL);
+ temp_file = g_strconcat (temp_dir, "/", filename, NULL);
fr_process_begin_command (comm->process, "cp");
fr_process_set_working_dir (comm->process, base_dir);
@@ -278,11 +273,11 @@
/* copy compressed file to the dest dir */
fr_process_begin_command (comm->process, "cp");
- fr_process_set_working_dir (comm->process, e_temp_dir);
+ fr_process_set_working_dir (comm->process, temp_dir);
fr_process_add_arg (comm->process, "-f");
fr_process_add_arg (comm->process, "--");
fr_process_add_arg (comm->process, "*");
- fr_process_add_arg (comm->process, comm->e_filename);
+ fr_process_add_arg (comm->process, comm->filename);
fr_process_end_command (comm->process);
/* remove the temp dir */
@@ -291,11 +286,10 @@
fr_process_set_sticky (comm->process, TRUE);
fr_process_add_arg (comm->process, "-rf");
fr_process_add_arg (comm->process, "--");
- fr_process_add_arg (comm->process, e_temp_dir);
+ fr_process_add_arg (comm->process, temp_dir);
fr_process_end_command (comm->process);
g_free (temp_file);
- g_free (e_temp_dir);
g_free (temp_dir);
}
@@ -318,32 +312,23 @@
const char *password)
{
char *temp_dir;
- char *e_temp_dir;
char *dest_file;
- char *e_dest_file;
char *temp_file;
- char *e_temp_file;
char *uncompr_file;
- char *e_uncompr_file;
char *compr_file;
- /* create a temp dir. */
-
- temp_dir = get_temp_work_dir ();
- e_temp_dir = fr_command_escape (comm, temp_dir);
-
/* copy file to the temp dir, remove the already existing file first */
+ temp_dir = get_temp_work_dir ();
temp_file = g_strconcat (temp_dir,
"/",
file_name_from_path (comm->filename),
NULL);
- e_temp_file = fr_command_escape (comm, temp_file);
fr_process_begin_command (comm->process, "cp");
fr_process_add_arg (comm->process, "-f");
- fr_process_add_arg (comm->process, comm->e_filename);
- fr_process_add_arg (comm->process, e_temp_file);
+ fr_process_add_arg (comm->process, comm->filename);
+ fr_process_add_arg (comm->process, temp_file);
fr_process_end_command (comm->process);
/* uncompress the file */
@@ -353,27 +338,27 @@
fr_process_add_arg (comm->process, "-f");
fr_process_add_arg (comm->process, "-d");
fr_process_add_arg (comm->process, "-n");
- fr_process_add_arg (comm->process, e_temp_file);
+ fr_process_add_arg (comm->process, temp_file);
fr_process_end_command (comm->process);
}
else if (is_mime_type (comm->mime_type, "application/x-bzip")) {
fr_process_begin_command (comm->process, "bzip2");
fr_process_add_arg (comm->process, "-f");
fr_process_add_arg (comm->process, "-d");
- fr_process_add_arg (comm->process, e_temp_file);
+ fr_process_add_arg (comm->process, temp_file);
fr_process_end_command (comm->process);
}
else if (is_mime_type (comm->mime_type, "application/x-gzip")) {
fr_process_begin_command (comm->process, "uncompress");
fr_process_add_arg (comm->process, "-f");
- fr_process_add_arg (comm->process, e_temp_file);
+ fr_process_add_arg (comm->process, temp_file);
fr_process_end_command (comm->process);
}
else if (is_mime_type (comm->mime_type, "application/x-lzma")) {
fr_process_begin_command (comm->process, "lzma");
fr_process_add_arg (comm->process, "-f");
fr_process_add_arg (comm->process, "-d");
- fr_process_add_arg (comm->process, e_temp_file);
+ fr_process_add_arg (comm->process, temp_file);
fr_process_end_command (comm->process);
}
else if (is_mime_type (comm->mime_type, "application/x-lzop")) {
@@ -382,14 +367,13 @@
fr_process_add_arg (comm->process, "-d");
fr_process_add_arg (comm->process, "-fU");
fr_process_add_arg (comm->process, "--no-stdin");
- fr_process_add_arg (comm->process, e_temp_file);
+ fr_process_add_arg (comm->process, temp_file);
fr_process_end_command (comm->process);
}
/* copy uncompress file to the dest dir */
uncompr_file = remove_extension_from_path (temp_file);
- e_uncompr_file = fr_command_escape (comm, uncompr_file);
compr_file = get_uncompressed_name_from_archive (comm, comm->filename);
if (compr_file == NULL)
@@ -398,14 +382,13 @@
"/",
compr_file,
NULL);
- e_dest_file = fr_command_escape (comm, dest_file);
g_free (compr_file);
g_free (dest_file);
fr_process_begin_command (comm->process, "cp");
fr_process_add_arg (comm->process, "-f");
- fr_process_add_arg (comm->process, e_uncompr_file);
- fr_process_add_arg (comm->process, e_dest_file);
+ fr_process_add_arg (comm->process, uncompr_file);
+ fr_process_add_arg (comm->process, dest_file);
fr_process_end_command (comm->process);
/* remove the temp dir */
@@ -413,15 +396,11 @@
fr_process_begin_command (comm->process, "rm");
fr_process_set_sticky (comm->process, TRUE);
fr_process_add_arg (comm->process, "-rf");
- fr_process_add_arg (comm->process, e_temp_dir);
+ fr_process_add_arg (comm->process, temp_dir);
fr_process_end_command (comm->process);
- g_free (e_dest_file);
g_free (uncompr_file);
- g_free (e_uncompr_file);
g_free (temp_file);
- g_free (e_temp_file);
- g_free (e_temp_dir);
g_free (temp_dir);
}
Modified: trunk/src/fr-command-cpio.c
==============================================================================
--- trunk/src/fr-command-cpio.c (original)
+++ trunk/src/fr-command-cpio.c Tue Jun 10 17:04:20 2008
@@ -153,7 +153,9 @@
list__process_line,
comm);
- fr_process_begin_command (comm->process, "cpio -itv <");
+ fr_process_begin_command (comm->process, "sh");
+ fr_process_add_arg (comm->process, "-c");
+ fr_process_add_arg (comm->process, "cpio -itv <");
fr_process_add_arg (comm->process, comm->e_filename);
fr_process_end_command (comm->process);
fr_process_start (comm->process);
@@ -171,13 +173,13 @@
{
GList *scan;
- fr_process_begin_command (comm->process, "cpio -idu");
+ fr_process_begin_command (comm->process, "sh");
+ fr_process_add_arg (comm->process, "-c");
+ fr_process_add_arg (comm->process, "cpio -idu");
if (dest_dir != NULL)
fr_process_set_working_dir (comm->process, dest_dir);
- for (scan = file_list; scan; scan = scan->next) {
- char *filename = (char*) scan->data;
- fr_process_add_arg (comm->process, filename);
- }
+ for (scan = file_list; scan; scan = scan->next)
+ fr_process_add_arg (comm->process, scan->data);
fr_process_add_arg (comm->process, "<");
fr_process_add_arg (comm->process, comm->e_filename);
fr_process_end_command (comm->process);
Modified: trunk/src/fr-command-iso.c
==============================================================================
--- trunk/src/fr-command-iso.c (original)
+++ trunk/src/fr-command-iso.c Tue Jun 10 17:04:20 2008
@@ -132,7 +132,6 @@
const char *password)
{
FrCommandIso *comm_iso = FR_COMMAND_ISO (comm);
- char *e_filename;
g_free (comm_iso->cur_path);
comm_iso->cur_path = NULL;
@@ -141,16 +140,14 @@
list__process_line,
comm);
- e_filename = g_shell_quote (comm->filename);
-
- fr_process_begin_command (comm->process, "sh " PRIVEXECDIR "isoinfo.sh");
+ fr_process_begin_command (comm->process, "sh");
+ fr_process_add_arg (comm->process, "-c");
+ fr_process_add_arg (comm->process, PRIVEXECDIR "isoinfo.sh");
fr_process_add_arg (comm->process, "-i");
- fr_process_add_arg (comm->process, e_filename);
+ fr_process_add_arg (comm->process, comm->e_filename);
fr_process_add_arg (comm->process, "-l");
fr_process_end_command (comm->process);
- g_free (e_filename);
-
fr_process_start (comm->process);
}
@@ -164,51 +161,47 @@
gboolean junk_paths,
const char *password)
{
- char *e_dest_dir;
- char *e_archive_filename;
GList *scan;
- e_dest_dir = fr_command_escape (comm, dest_dir);
- e_archive_filename = g_shell_quote (comm->filename);
-
for (scan = file_list; scan; scan = scan->next) {
char *path = scan->data;
const char *filename;
+ char *e_name;
char *file_dir;
- char *e_temp_dest_dir = NULL;
char *temp_dest_dir = NULL;
filename = file_name_from_path (path);
file_dir = remove_level_from_path (path);
if ((file_dir != NULL) && (strcmp (file_dir, "/") != 0))
- e_temp_dest_dir = g_build_filename (e_dest_dir, file_dir, NULL);
+ temp_dest_dir = g_build_filename (dest_dir, file_dir, NULL);
else
- e_temp_dest_dir = g_strdup (e_dest_dir);
+ temp_dest_dir = g_strdup (dest_dir);
g_free (file_dir);
- if (e_temp_dest_dir == NULL)
+ if (temp_dest_dir == NULL)
continue;
- temp_dest_dir = unescape_str (e_temp_dest_dir);
make_directory_tree_from_path (temp_dest_dir, 0700, NULL);
- fr_process_begin_command (comm->process, "sh " PRIVEXECDIR "isoinfo.sh");
+ fr_process_begin_command (comm->process, "sh");
fr_process_set_working_dir (comm->process, temp_dest_dir);
+ fr_process_add_arg (comm->process, "-c");
+ fr_process_add_arg (comm->process, PRIVEXECDIR "isoinfo.sh");
fr_process_add_arg (comm->process, "-i");
- fr_process_add_arg (comm->process, e_archive_filename);
+ fr_process_add_arg (comm->process, comm->e_filename);
fr_process_add_arg (comm->process, "-x");
fr_process_add_arg (comm->process, path);
fr_process_add_arg (comm->process, ">");
- fr_process_add_arg (comm->process, filename);
+
+ e_name = g_shell_quote (filename);
+ fr_process_add_arg (comm->process, e_name);
+ g_free (e_name);
+
fr_process_end_command (comm->process);
- g_free (e_temp_dest_dir);
g_free (temp_dest_dir);
}
- g_free (e_dest_dir);
- g_free (e_archive_filename);
-
fr_process_start (comm->process);
}
Modified: trunk/src/fr-command-jar.c
==============================================================================
--- trunk/src/fr-command-jar.c (original)
+++ trunk/src/fr-command-jar.c Tue Jun 10 17:04:20 2008
@@ -53,6 +53,7 @@
GList *file_list,
const char *base_dir,
gboolean update,
+ gboolean recursive,
const char *password,
FrCompression compression)
{
@@ -118,10 +119,10 @@
}
if (zip_list != NULL)
- parent_class->add (comm, zip_list, base_dir, update, password, compression);
+ parent_class->add (comm, zip_list, base_dir, update, FALSE, password, compression);
if (jar_list != NULL)
- parent_class->add (comm, jar_list, tmp_dir, update, password, compression);
+ parent_class->add (comm, jar_list, tmp_dir, update, FALSE, password, compression);
fr_process_begin_command (proc, "rm");
fr_process_set_working_dir (proc, "/");
Modified: trunk/src/fr-command-lha.c
==============================================================================
--- trunk/src/fr-command-lha.c (original)
+++ trunk/src/fr-command-lha.c Tue Jun 10 17:04:20 2008
@@ -219,7 +219,7 @@
fr_process_begin_command (comm->process, "lha");
fr_process_add_arg (comm->process, "lq");
- fr_process_add_arg (comm->process, comm->e_filename);
+ fr_process_add_arg (comm->process, comm->filename);
fr_process_end_command (comm->process);
fr_process_start (comm->process);
}
@@ -230,6 +230,7 @@
GList *file_list,
const char *base_dir,
gboolean update,
+ gboolean recursive,
const char *password,
FrCompression compression)
{
@@ -242,9 +243,9 @@
fr_process_add_arg (comm->process, "u");
else
fr_process_add_arg (comm->process, "a");
- fr_process_add_arg (comm->process, comm->e_filename);
+ fr_process_add_arg (comm->process, comm->filename);
for (scan = file_list; scan; scan = scan->next)
- fr_process_add_arg (comm->process, (gchar*) scan->data);
+ fr_process_add_arg (comm->process, scan->data);
fr_process_end_command (comm->process);
}
@@ -257,8 +258,7 @@
fr_process_begin_command (comm->process, "lha");
fr_process_add_arg (comm->process, "d");
- fr_process_add_arg (comm->process, comm->e_filename);
-
+ fr_process_add_arg (comm->process, comm->filename);
for (scan = file_list; scan; scan = scan->next)
fr_process_add_arg (comm->process, scan->data);
fr_process_end_command (comm->process);
@@ -295,7 +295,7 @@
options[i++] = 0;
fr_process_add_arg (comm->process, options);
- fr_process_add_arg (comm->process, comm->e_filename);
+ fr_process_add_arg (comm->process, comm->filename);
for (scan = file_list; scan; scan = scan->next)
fr_process_add_arg (comm->process, scan->data);
Modified: trunk/src/fr-command-rar.c
==============================================================================
--- trunk/src/fr-command-rar.c (original)
+++ trunk/src/fr-command-rar.c Tue Jun 10 17:04:20 2008
@@ -178,18 +178,8 @@
const char *password,
gboolean disable_query)
{
- if ((password != NULL) && (password[0] != '\0')) {
- char *arg;
- char *quoted_arg;
-
- arg = g_strdup_printf ("-p%s", password);
- quoted_arg = g_shell_quote (arg);
-
- fr_process_add_arg (comm->process, quoted_arg);
-
- g_free (quoted_arg);
- g_free (arg);
- }
+ if ((password != NULL) && (password[0] != '\0'))
+ fr_process_add_arg_concat (comm->process, "-p", password, NULL);
else if (disable_query)
fr_process_add_arg (comm->process, "-p-");
}
@@ -217,7 +207,7 @@
/* stop switches scanning */
fr_process_add_arg (comm->process, "--");
- fr_process_add_arg (comm->process, comm->e_filename);
+ fr_process_add_arg (comm->process, comm->filename);
fr_process_end_command (comm->process);
fr_process_start (comm->process);
}
@@ -228,6 +218,7 @@
GList *file_list,
const char *base_dir,
gboolean update,
+ gboolean recursive,
const char *password,
FrCompression compression)
{
@@ -262,10 +253,10 @@
/* stop switches scanning */
fr_process_add_arg (comm->process, "--");
- fr_process_add_arg (comm->process, comm->e_filename);
+ fr_process_add_arg (comm->process, comm->filename);
for (scan = file_list; scan; scan = scan->next)
- fr_process_add_arg (comm->process, (gchar*) scan->data);
+ fr_process_add_arg (comm->process, scan->data);
fr_process_end_command (comm->process);
}
@@ -283,7 +274,7 @@
/* stop switches scanning */
fr_process_add_arg (comm->process, "--");
- fr_process_add_arg (comm->process, comm->e_filename);
+ fr_process_add_arg (comm->process, comm->filename);
for (scan = file_list; scan; scan = scan->next)
fr_process_add_arg (comm->process, scan->data);
@@ -328,16 +319,13 @@
/* stop switches scanning */
fr_process_add_arg (comm->process, "--");
- fr_process_add_arg (comm->process, comm->e_filename);
+ fr_process_add_arg (comm->process, comm->filename);
for (scan = file_list; scan; scan = scan->next)
fr_process_add_arg (comm->process, scan->data);
- if (dest_dir != NULL) {
- char *e_dest_dir = fr_command_escape (comm, dest_dir);
- fr_process_add_arg (comm->process, e_dest_dir);
- g_free (e_dest_dir);
- }
+ if (dest_dir != NULL)
+ fr_process_add_arg (comm->process, dest_dir);
fr_process_end_command (comm->process);
}
@@ -362,7 +350,7 @@
/* stop switches scanning */
fr_process_add_arg (comm->process, "--");
- fr_process_add_arg (comm->process, comm->e_filename);
+ fr_process_add_arg (comm->process, comm->filename);
fr_process_end_command (comm->process);
}
Modified: trunk/src/fr-command-rpm.c
==============================================================================
--- trunk/src/fr-command-rpm.c (original)
+++ trunk/src/fr-command-rpm.c Tue Jun 10 17:04:20 2008
@@ -159,8 +159,10 @@
list__process_line,
comm);
- fr_process_begin_command (comm->process, "rpm2cpio");
- fr_process_add_arg (comm->process, comm->e_filename);
+ fr_process_begin_command (comm->process, "sh");
+ fr_process_add_arg (comm->process, "-c");
+ fr_process_add_arg (comm->process, "rpm2cpio");
+ fr_process_add_arg (comm->process, comm->filename);
fr_process_add_arg (comm->process, "| cpio -itv");
fr_process_end_command (comm->process);
fr_process_start (comm->process);
@@ -178,14 +180,17 @@
{
GList *scan;
- fr_process_begin_command (comm->process, "rpm2cpio");
+ fr_process_begin_command (comm->process, "sh");
+ fr_process_add_arg (comm->process, "-c");
+ fr_process_add_arg (comm->process, "rpm2cpio");
if (dest_dir != NULL)
fr_process_set_working_dir (comm->process, dest_dir);
- fr_process_add_arg (comm->process, comm->e_filename);
+ fr_process_add_arg (comm->process, comm->filename);
fr_process_add_arg (comm->process, "| cpio -idu");
for (scan = file_list; scan; scan = scan->next) {
- char *filename = (char*) scan->data;
+ char *filename = g_shell_quote (scan->data);
fr_process_add_arg (comm->process, filename);
+ g_free (filename);
}
fr_process_end_command (comm->process);
fr_process_start (comm->process);
Modified: trunk/src/fr-command-tar.c
==============================================================================
--- trunk/src/fr-command-tar.c (original)
+++ trunk/src/fr-command-tar.c Tue Jun 10 17:04:20 2008
@@ -246,7 +246,7 @@
fr_process_add_arg (comm->process, "--force-local");
fr_process_add_arg (comm->process, "--no-wildcards");
fr_process_add_arg (comm->process, "-tvf");
- fr_process_add_arg (comm->process, comm->e_filename);
+ fr_process_add_arg (comm->process, comm->filename);
add_compress_arg (comm);
fr_process_end_command (comm->process);
fr_process_start (comm->process);
@@ -291,6 +291,7 @@
GList *file_list,
const char *base_dir,
gboolean update,
+ gboolean recursive,
const char *password,
FrCompression compression)
{
@@ -303,16 +304,15 @@
begin_tar_command (comm);
fr_process_add_arg (comm->process, "--force-local");
- fr_process_add_arg (comm->process, "--no-recursion");
+ if (! recursive)
+ fr_process_add_arg (comm->process, "--no-recursion");
fr_process_add_arg (comm->process, "--no-wildcards");
fr_process_add_arg (comm->process, "-v");
fr_process_add_arg (comm->process, "-p");
if (base_dir != NULL) {
- char *e_base_dir = shell_escape (base_dir);
fr_process_add_arg (comm->process, "-C");
- fr_process_add_arg (comm->process, e_base_dir);
- g_free (e_base_dir);
+ fr_process_add_arg (comm->process, base_dir);
}
fr_process_add_arg (comm->process, "-rf");
@@ -404,14 +404,12 @@
fr_process_add_arg (comm->process, "--keep-newer-files");
fr_process_add_arg (comm->process, "-xf");
- fr_process_add_arg (comm->process, comm->e_filename);
+ fr_process_add_arg (comm->process, comm->filename);
add_compress_arg (comm);
if (dest_dir != NULL) {
- char *e_dest_dir = shell_escape (dest_dir);
fr_process_add_arg (comm->process, "-C");
- fr_process_add_arg (comm->process, e_dest_dir);
- g_free (e_dest_dir);
+ fr_process_add_arg (comm->process, dest_dir);
}
fr_process_add_arg (comm->process, "--");
@@ -531,7 +529,6 @@
}
else if (is_mime_type (comm->mime_type, "application/x-7z-compressed-tar")) {
FrCommandTar *comm_tar = (FrCommandTar*) comm;
- char *e_name;
fr_process_begin_command (comm->process, comm_tar->compress_command);
fr_process_set_sticky (comm->process, TRUE);
@@ -552,9 +549,7 @@
fr_process_add_arg (comm->process, "-l");
new_name = g_strconcat (c_tar->uncomp_filename, ".7z", NULL);
- e_name = shell_escape (new_name);
- fr_process_add_arg (comm->process, e_name);
- g_free (e_name);
+ fr_process_add_arg_concat (comm->process, new_name);
fr_process_add_arg (comm->process, c_tar->uncomp_filename);
fr_process_end_command (comm->process);
@@ -563,9 +558,7 @@
fr_process_begin_command (comm->process, "rm");
fr_process_add_arg (comm->process, "-f");
- e_name = shell_escape (c_tar->uncomp_filename);
- fr_process_add_arg (comm->process, e_name);
- g_free (e_name);
+ fr_process_add_arg (comm->process, c_tar->uncomp_filename);
fr_process_end_command (comm->process);
}
@@ -578,7 +571,7 @@
fr_process_set_sticky (comm->process, TRUE);
fr_process_add_arg (comm->process, "-f");
fr_process_add_arg (comm->process, new_name);
- fr_process_add_arg (comm->process, comm->e_filename);
+ fr_process_add_arg (comm->process, comm->filename);
fr_process_end_command (comm->process);
tmp_dir = remove_level_from_path (new_name);
@@ -681,16 +674,13 @@
char *template;
char *result = NULL;
char *temp_name = NULL;
- char *e_temp_name = NULL;
template = g_strconcat (dirname, "/.fr-XXXXXX", NULL);
result = mkdtemp (template);
temp_name = g_build_filename (result, file_name_from_path (filepath), NULL);
- e_temp_name = shell_escape (temp_name);
- g_free (temp_name);
g_free (template);
- return e_temp_name;
+ return temp_name;
}
@@ -718,13 +708,13 @@
if (archive_exists) {
fr_process_begin_command (comm->process, "mv");
fr_process_add_arg (comm->process, "-f");
- fr_process_add_arg (comm->process, comm->e_filename);
+ fr_process_add_arg (comm->process, comm->filename);
fr_process_add_arg (comm->process, tmp_name);
fr_process_end_command (comm->process);
}
}
else
- tmp_name = g_strdup (comm->e_filename);
+ tmp_name = g_strdup (comm->filename);
if (archive_exists) {
if (is_mime_type (comm->mime_type, "application/x-compressed-tar")) {
@@ -791,22 +781,6 @@
}
-static char *
-fr_command_tar_escape (FrCommand *comm,
- const char *str)
-{
- char *estr;
- char *estr2;
-
- estr = escape_str (str, "\\");
- estr2 = escape_str (estr, "\\$?*'`& !|()@#:;<>");
-
- g_free (estr);
-
- return estr2;
-}
-
-
static void
fr_command_tar_handle_error (FrCommand *comm,
FrProcError *error)
@@ -893,8 +867,6 @@
afc->recompress = fr_command_tar_recompress;
afc->uncompress = fr_command_tar_uncompress;
-
- afc->escape = fr_command_tar_escape;
}
Modified: trunk/src/fr-command-unstuff.c
==============================================================================
--- trunk/src/fr-command-unstuff.c (original)
+++ trunk/src/fr-command-unstuff.c Tue Jun 10 17:04:20 2008
@@ -204,7 +204,7 @@
fr_process_add_arg (comm->process, arg);
g_free (arg);
- filename = unstuff_is_shit_with_filenames (comm->e_filename);
+ filename = unstuff_is_shit_with_filenames (comm->filename);
fr_process_add_arg (comm->process, filename);
g_free (filename);
fr_process_end_command (comm->process);
@@ -229,20 +229,21 @@
fr_process_begin_command (comm->process, "unstuff");
if (dest_dir != NULL) {
- char *e_dest_dir = fr_command_escape (comm, dest_dir);
- char *e_dest_dir_dots = unstuff_is_shit_with_filenames (e_dest_dir);
- char *arg = g_strdup_printf ("-d=%s", e_dest_dir_dots);
+ char *dest_dir_dots;
+ char *arg;
+
+ dest_dir_dots = unstuff_is_shit_with_filenames (dest_dir);
+ arg = g_strdup_printf ("-d=%s", dest_dir_dots);
fr_process_add_arg (comm->process, arg);
FR_COMMAND_UNSTUFF (comm)->target_dir = NULL;
g_free (arg);
- g_free (e_dest_dir);
- g_free (e_dest_dir_dots);
+ g_free (dest_dir_dots);
}
fr_process_add_arg (comm->process, "--trace");
/* unstuff doesn't like file paths starting with /, that's so shite */
- filename = unstuff_is_shit_with_filenames (comm->e_filename);
+ filename = unstuff_is_shit_with_filenames (comm->filename);
fr_process_add_arg (comm->process, filename);
g_free (filename);
Modified: trunk/src/fr-command-zip.c
==============================================================================
--- trunk/src/fr-command-zip.c (original)
+++ trunk/src/fr-command-zip.c Tue Jun 10 17:04:20 2008
@@ -91,53 +91,6 @@
}
-static char *
-fr_command_zip_escape (FrCommand *comm,
- const char *str)
-{
- char *estr;
- char *estr2;
-
- estr = escape_str (str, "\\");
- estr2 = shell_escape (estr);
-
- g_free (estr);
-
- return estr2;
-
-}
-
-
-static char*
-zip_escape (const char *str)
-{
- return escape_str (str, "*?[]");
-}
-
-
-static char*
-prepend_path_separator (const char *str)
-{
- if (*str == '-' || g_str_has_prefix (str, "\\-"))
- return g_strconcat (".", G_DIR_SEPARATOR_S, str, NULL);
- else
- return g_strdup (str);
-}
-
-
-static char*
-prepend_path_separator_zip_escape (const char *str)
-{
- char *tmp1, *tmp2;
-
- tmp2 = prepend_path_separator (str);
- tmp1 = zip_escape (tmp2);
- g_free (tmp2);
-
- return tmp1;
-}
-
-
static void
list__process_line (char *line,
gpointer data)
@@ -209,34 +162,12 @@
static void
-add_filename_arg (FrCommand *comm)
-{
- char *temp = prepend_path_separator (comm->e_filename);
- fr_process_add_arg (comm->process, temp);
- g_free (temp);
-}
-
-
-static void
-add_password_arg (FrCommand *comm,
- const char *password,
- gboolean always_specify)
+add_password_arg (FrCommand *comm,
+ const char *password)
{
- if (always_specify || ((password != NULL) && (password[0] != '\0'))) {
- char *arg;
- char *e_password;
-
+ if ((password != NULL) && (password[0] != '\0')) {
fr_process_add_arg (comm->process, "-P");
-
- e_password = escape_str (password, "\"*?[]'`()$!;");
- if (e_password != NULL) {
- arg = g_strconcat ("\"", e_password, "\"", NULL);
- g_free (e_password);
- } else
- arg = g_strdup ("\"\"");
-
- fr_process_add_arg (comm->process, arg);
- g_free (arg);
+ fr_process_add_arg (comm->process, password);
}
}
@@ -253,7 +184,7 @@
fr_process_begin_command (comm->process, "unzip");
fr_process_add_arg (comm->process, "-ZTs");
- add_filename_arg (comm);
+ fr_process_add_arg (comm->process, comm->filename);
fr_process_end_command (comm->process);
fr_process_start (comm->process);
}
@@ -282,6 +213,7 @@
GList *file_list,
const char *base_dir,
gboolean update,
+ gboolean recursive,
const char *password,
FrCompression compression)
{
@@ -302,7 +234,7 @@
if (update)
fr_process_add_arg (comm->process, "-u");
- add_password_arg (comm, password, FALSE);
+ add_password_arg (comm, password);
switch (compression) {
case FR_COMPRESSION_VERY_FAST:
@@ -315,13 +247,10 @@
fr_process_add_arg (comm->process, "-9"); break;
}
- add_filename_arg (comm);
+ fr_process_add_arg (comm->process, comm->filename);
- for (scan = file_list; scan; scan = scan->next) {
- char *temp = prepend_path_separator ((char*) scan->data);
- fr_process_add_arg (comm->process, temp);
- g_free (temp);
- }
+ for (scan = file_list; scan; scan = scan->next)
+ fr_process_add_arg (comm->process, scan->data);
fr_process_end_command (comm->process);
}
@@ -339,13 +268,10 @@
fr_process_begin_command (comm->process, "zip");
fr_process_add_arg (comm->process, "-d");
- add_filename_arg (comm);
+ fr_process_add_arg (comm->process, comm->filename);
- for (scan = file_list; scan; scan = scan->next) {
- char *temp = prepend_path_separator_zip_escape ((char*) scan->data);
- fr_process_add_arg (comm->process, temp);
- g_free (temp);
- }
+ for (scan = file_list; scan; scan = scan->next)
+ fr_process_add_arg (comm->process, scan->data);
fr_process_end_command (comm->process);
}
@@ -369,32 +295,22 @@
fr_process_begin_command (comm->process, "unzip");
if (dest_dir != NULL) {
- char *e_dest_dir = fr_command_escape (comm, dest_dir);
fr_process_add_arg (comm->process, "-d");
- fr_process_add_arg (comm->process, e_dest_dir);
- g_free (e_dest_dir);
+ fr_process_add_arg (comm->process, dest_dir);
}
-
if (overwrite)
fr_process_add_arg (comm->process, "-o");
else
fr_process_add_arg (comm->process, "-n");
-
if (skip_older)
fr_process_add_arg (comm->process, "-u");
-
if (junk_paths)
fr_process_add_arg (comm->process, "-j");
+ add_password_arg (comm, password);
+ fr_process_add_arg (comm->process, comm->filename);
- add_password_arg (comm, password, TRUE);
-
- add_filename_arg (comm);
-
- for (scan = file_list; scan; scan = scan->next) {
- char *temp = prepend_path_separator_zip_escape ((char*) scan->data);
- fr_process_add_arg (comm->process, temp);
- g_free (temp);
- }
+ for (scan = file_list; scan; scan = scan->next)
+ fr_process_add_arg (comm->process, scan->data);
fr_process_end_command (comm->process);
}
@@ -406,8 +322,8 @@
{
fr_process_begin_command (comm->process, "unzip");
fr_process_add_arg (comm->process, "-t");
- add_password_arg (comm, password, TRUE);
- add_filename_arg (comm);
+ add_password_arg (comm, password);
+ fr_process_add_arg (comm->process, comm->filename);
fr_process_end_command (comm->process);
}
@@ -479,8 +395,6 @@
afc->test = fr_command_zip_test;
afc->handle_error = fr_command_zip_handle_error;
afc->set_mime_type = fr_command_zip_set_mime_type;
-
- afc->escape = fr_command_zip_escape;
}
Modified: trunk/src/fr-command-zoo.c
==============================================================================
--- trunk/src/fr-command-zoo.c (original)
+++ trunk/src/fr-command-zoo.c Tue Jun 10 17:04:20 2008
@@ -229,7 +229,7 @@
fr_process_begin_command (zoo_comm->process, "zoo");
fr_process_add_arg (zoo_comm->process, "lq");
- fr_process_add_arg (zoo_comm->process, zoo_comm->e_filename);
+ fr_process_add_arg (zoo_comm->process, zoo_comm->filename);
fr_process_end_command (zoo_comm->process);
fr_process_start (zoo_comm->process);
}
@@ -240,6 +240,7 @@
GList *file_list,
const char *base_dir,
gboolean update,
+ gboolean recursive,
const char *password,
FrCompression compression)
{
@@ -256,7 +257,7 @@
else
fr_process_add_arg (comm->process, "aP");
- fr_process_add_arg (comm->process, comm->e_filename);
+ fr_process_add_arg (comm->process, comm->filename);
for (scan = file_list; scan; scan = scan->next)
fr_process_add_arg (comm->process, scan->data);
@@ -274,7 +275,7 @@
fr_process_begin_command (comm->process, "zoo");
fr_process_add_arg (comm->process, "DP");
- fr_process_add_arg (comm->process, comm->e_filename);
+ fr_process_add_arg (comm->process, comm->filename);
for (scan = file_list; scan; scan = scan->next)
fr_process_add_arg (comm->process, scan->data);
@@ -300,7 +301,7 @@
else
fr_process_add_arg (comm->process, "x");
- fr_process_add_arg (comm->process, comm->e_filename);
+ fr_process_add_arg (comm->process, comm->filename);
if (dest_dir != NULL)
fr_process_set_working_dir (comm->process, dest_dir);
@@ -318,7 +319,7 @@
{
fr_process_begin_command (comm->process, "zoo");
fr_process_add_arg (comm->process, "-test");
- fr_process_add_arg (comm->process, comm->e_filename);
+ fr_process_add_arg (comm->process, comm->filename);
fr_process_end_command (comm->process);
}
Modified: trunk/src/fr-command.c
==============================================================================
--- trunk/src/fr-command.c (original)
+++ trunk/src/fr-command.c Tue Jun 10 17:04:20 2008
@@ -111,6 +111,7 @@
GList *file_list,
const char *base_dir,
gboolean update,
+ gboolean recursive,
const char *password,
FrCompression compression)
{
@@ -156,14 +157,6 @@
}
-char *
-base_fr_command_escape (FrCommand *comm,
- const char *str)
-{
- return shell_escape (str);
-}
-
-
static void
base_fr_command_handle_error (FrCommand *comm,
FrProcError *error)
@@ -319,7 +312,6 @@
class->test = base_fr_command_test;
class->uncompress = base_fr_command_uncompress;
class->recompress = base_fr_command_recompress;
- class->escape = base_fr_command_escape;
class->handle_error = base_fr_command_handle_error;
class->set_mime_type = base_fr_command_set_mime_type;
class->start = NULL;
@@ -472,7 +464,7 @@
else
comm->filename = g_strdup (filename);
- comm->e_filename = shell_escape (comm->filename);
+ comm->e_filename = g_shell_quote (comm->filename);
debug (DEBUG_INFO, "filename : %s\n", comm->filename);
debug (DEBUG_INFO, "e_filename : %s\n", comm->e_filename);
@@ -506,6 +498,7 @@
GList *file_list,
const char *base_dir,
gboolean update,
+ gboolean recursive,
const char *password,
FrCompression compression)
{
@@ -519,6 +512,7 @@
file_list,
base_dir,
update,
+ recursive,
password,
compression);
}
@@ -594,14 +588,6 @@
}
-char *
-fr_command_escape (FrCommand *comm,
- const char *str)
-{
- return FR_COMMAND_GET_CLASS (G_OBJECT (comm))->escape (comm, str);
-}
-
-
gboolean
fr_command_is_capable_of (FrCommand *comm,
FrCommandCaps requested_capabilities)
Modified: trunk/src/fr-command.h
==============================================================================
--- trunk/src/fr-command.h (original)
+++ trunk/src/fr-command.h Tue Jun 10 17:04:20 2008
@@ -114,6 +114,7 @@
GList *file_list,
const char *base_dir,
gboolean update,
+ gboolean recursive,
const char *password,
FrCompression compression);
void (*delete) (FrCommand *comm,
@@ -132,8 +133,6 @@
FrCompression compression);
void (*handle_error) (FrCommand *comm,
FrProcError *error);
- char * (*escape) (FrCommand *comm,
- const char *str);
/*<protected virtual functions>*/
@@ -162,6 +161,7 @@
GList *file_list,
const char *base_dir,
gboolean update,
+ gboolean recursive,
const char *password,
FrCompression compression);
void fr_command_delete (FrCommand *comm,
@@ -178,8 +178,6 @@
void fr_command_uncompress (FrCommand *comm);
void fr_command_recompress (FrCommand *comm,
FrCompression compression);
-char * fr_command_escape (FrCommand *comm,
- const char *str);
gboolean fr_command_is_capable_of (FrCommand *comm,
FrCommandCaps capabilities);
Modified: trunk/src/fr-process.c
==============================================================================
--- trunk/src/fr-process.c (original)
+++ trunk/src/fr-process.c Tue Jun 10 17:04:20 2008
@@ -343,6 +343,27 @@
void
+fr_process_add_arg_concat (FrProcess *fr_proc,
+ const char *arg1,
+ ...)
+{
+ GString *arg;
+ va_list args;
+ char *s;
+
+ arg = g_string_new ("");
+
+ va_start (args, arg1);
+ while ((s = va_arg (args, char*)) != NULL)
+ g_string_append (arg, s);
+ va_end (args);
+
+ fr_process_add_arg (fr_proc, arg->str);
+ g_string_free (arg, TRUE);
+}
+
+
+void
fr_process_set_arg_at (FrProcess *fr_proc,
int n_comm,
int n_arg,
@@ -586,7 +607,6 @@
{
FrCommandInfo *c_info;
GList *arg_list, *scan;
- GString *command;
char *dir;
char **argv;
int i = 0;
@@ -601,8 +621,12 @@
if (dir != NULL)
debug (DEBUG_INFO, "cd %s\n", dir);
- command = NULL;
-
+ argv = g_new (char *, g_list_length (arg_list) + 1);
+ for (scan = arg_list; scan; scan = scan->next)
+ argv[i++] = scan->data;
+ argv[i] = NULL;
+
+/*
argv = g_new (char *, 4);
argv[i++] = "/bin/sh";
argv[i++] = "-c";
@@ -617,12 +641,13 @@
argv[i++] = command->str;
argv[i] = NULL;
+*/
#ifdef DEBUG
{
int j;
- g_print ("/bin/sh ");
+ /*g_print ("/bin/sh ");*/
for (j = 0; j < i; j++)
g_print ("%s ", argv[j]);
g_print ("\n");
@@ -650,15 +675,11 @@
g_signal_emit (G_OBJECT (fr_proc),
fr_process_signals[DONE],
0);
-
g_free (argv);
- g_string_free (command, TRUE);
-
return;
}
g_free (argv);
- g_string_free (command, TRUE);
fcntl (fr_proc->output_fd, F_SETFL, O_NONBLOCK);
fcntl (fr_proc->error_fd, F_SETFL, O_NONBLOCK);
Modified: trunk/src/fr-process.h
==============================================================================
--- trunk/src/fr-process.h (original)
+++ trunk/src/fr-process.h Tue Jun 10 17:04:20 2008
@@ -139,6 +139,9 @@
int index);
void fr_process_add_arg (FrProcess *fr_proc,
const char *arg);
+void fr_process_add_arg_concat (FrProcess *fr_proc,
+ const char *arg,
+ ...);
void fr_process_set_arg_at (FrProcess *fr_proc,
int n_comm,
int n_arg,
Modified: trunk/src/fr-window.c
==============================================================================
--- trunk/src/fr-window.c (original)
+++ trunk/src/fr-window.c Tue Jun 10 17:04:20 2008
@@ -1759,7 +1759,7 @@
char *name;
uri = g_file_get_uri (window->archive->file);
- name = g_filename_display_basename (uri);
+ name = g_uri_display_basename (uri);
gtk_tree_store_append (window->priv->tree_store, &node, NULL);
gtk_tree_store_set (window->priv->tree_store, &node,
@@ -1924,7 +1924,7 @@
char *title;
char *name;
- name = g_filename_display_basename (fr_window_get_archive_uri (window));
+ name = g_uri_display_basename (fr_window_get_archive_uri (window));
title = g_strdup_printf ("%s %s",
name,
window->archive->read_only ? _("[read only]") : "");
@@ -2369,7 +2369,7 @@
window->priv->pd_last_archive = g_strdup (current_archive);
- name = g_filename_display_basename (window->priv->pd_last_archive);
+ name = g_uri_display_basename (window->priv->pd_last_archive);
gtk_label_set_text (GTK_LABEL (window->priv->pd_archive), name);
g_free (name);
}
@@ -2460,7 +2460,7 @@
gtk_box_pack_start (GTK_BOX (hbox), lbl, FALSE, FALSE, 0);
window->priv->pd_last_archive = g_strdup (window->priv->archive_uri);
- name = g_filename_display_basename (window->priv->pd_last_archive);
+ name = g_uri_display_basename (window->priv->pd_last_archive);
lbl = window->priv->pd_archive = gtk_label_new (name);
g_free (name);
@@ -2791,8 +2791,7 @@
/* nothing */
}
else if (error->type != FR_PROC_ERROR_NONE) {
- char *msg = NULL;
- char *unescaped_uri = NULL;
+ char *msg = NULL;
char *utf8_name;
char *details = NULL;
GtkWindow *dialog_parent;
@@ -2821,9 +2820,7 @@
case FR_ACTION_LOADING_ARCHIVE:
dialog_parent = window->priv->load_error_parent_window;
- unescaped_uri = g_filename_display_name (window->priv->archive_uri);
- utf8_name = g_filename_display_basename (unescaped_uri);
- g_free (unescaped_uri);
+ utf8_name = g_uri_display_basename (window->priv->archive_uri);
msg = g_strdup_printf (_("Could not open \"%s\""), utf8_name);
g_free (utf8_name);
break;
@@ -2913,45 +2910,8 @@
handle_errors (window, archive, action, error);
- if (error->type == FR_PROC_ERROR_NONE) {
- /*GtkWidget *d;
- char *filename;
- char *basename;
- char *msg;
- int result;*/
-
+ if (error->type == FR_PROC_ERROR_NONE)
open_progress_dialog_with_open_archive (window);
-
- /*
- filename = g_file_get_basename (window->priv->convert_data.new_archive->file);
- basename = g_filename_display_basename (filename);
- msg = g_strdup_printf (_("The archive \"%s\" has been created successfully"), basename);
- g_free (filename);
-
- d = _gtk_message_dialog_new (GTK_WINDOW (window),
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_STOCK_DIALOG_INFO,
- msg,
- "",
- _("_Open the Archive"), 1,
- GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
- NULL);
- gtk_dialog_set_default_response (GTK_DIALOG (d), GTK_RESPONSE_CLOSE);
- result = gtk_dialog_run (GTK_DIALOG (d));
- gtk_widget_destroy (GTK_WIDGET (d));
-
- if (result == 1) {
- GtkWidget *new_window;
- char *uri;
-
- uri = g_file_get_uri (window->priv->convert_data.new_archive->file);
- new_window = fr_window_new ();
- gtk_widget_show (new_window);
- fr_window_archive_open (FR_WINDOW (new_window), uri, GTK_WINDOW (new_window));
- g_free (uri);
- }
- */
- }
remove_local_directory (window->priv->convert_data.temp_dir);
fr_window_convert_data_free (window, FALSE);
@@ -3107,7 +3067,6 @@
NULL,
FALSE,
TRUE,
- FALSE,
window->priv->convert_data.password,
window->priv->compression);
g_free (source_dir);
@@ -6048,14 +6007,11 @@
window->priv->convert_data.new_archive = fr_archive_new ();
if (! fr_archive_create (window->priv->convert_data.new_archive, uri)) {
- GtkWidget *d;
- char *unescaped_uri = NULL;
+ GtkWidget *d;
char *utf8_name;
char *message;
- unescaped_uri = g_filename_display_name (uri);
- utf8_name = g_filename_display_basename (unescaped_uri);
- g_free (unescaped_uri);
+ utf8_name = g_uri_display_basename (uri);
message = g_strdup_printf (_("Could not save the archive \"%s\""), utf8_name);
g_free (utf8_name);
@@ -6206,7 +6162,6 @@
const char *base_dir,
const char *dest_dir,
gboolean update,
- gboolean recursive,
gboolean follow_links)
{
fr_archive_add_with_wildcard (window->archive,
@@ -6216,7 +6171,6 @@
base_dir,
(dest_dir == NULL)? fr_window_get_current_location (window): dest_dir,
update,
- recursive,
follow_links,
window->priv->password,
window->priv->compression);
@@ -6943,11 +6897,9 @@
{
GList *file_list;
char *tmp_dir;
- char *e_tmp_dir;
FrArchive *archive = window->archive;
GList *scan, *new_file_list = NULL;
RenameData *rdata;
- char *new_name_uri;
rdata = rename_data_new (path_to_rename,
old_name,
@@ -6962,21 +6914,20 @@
fr_process_clear (archive->process);
tmp_dir = get_temp_work_dir ();
- e_tmp_dir = shell_escape (tmp_dir);
if (is_dir)
file_list = get_dir_list_from_path (window, rdata->path_to_rename);
else
file_list = g_list_append (NULL, g_strdup (rdata->path_to_rename));
- fr_archive_extract (archive,
- file_list,
- tmp_dir,
- NULL,
- FALSE,
- TRUE,
- FALSE,
- window->priv->password);
+ fr_archive_extract_to_local (archive,
+ file_list,
+ tmp_dir,
+ NULL,
+ FALSE,
+ TRUE,
+ FALSE,
+ window->priv->password);
fr_archive_remove (archive,
file_list,
@@ -6988,28 +6939,20 @@
if (rdata->is_dir) {
char *old_path, *new_path;
- char *e_old_path, *e_new_path;
old_path = g_build_filename (tmp_dir, rdata->current_dir, rdata->old_name, NULL);
new_path = g_build_filename (tmp_dir, rdata->current_dir, rdata->new_name, NULL);
- e_old_path = shell_escape (old_path);
- e_new_path = shell_escape (new_path);
-
fr_process_begin_command (archive->process, "mv");
fr_process_add_arg (archive->process, "-f");
- fr_process_add_arg (archive->process, e_old_path);
- fr_process_add_arg (archive->process, e_new_path);
+ fr_process_add_arg (archive->process, old_path);
+ fr_process_add_arg (archive->process, new_path);
fr_process_end_command (archive->process);
g_free (old_path);
g_free (new_path);
- g_free (e_old_path);
- g_free (e_new_path);
}
- new_name_uri = g_filename_to_uri (rdata->new_name, NULL, NULL);
-
for (scan = file_list; scan; scan = scan->next) {
const char *current_dir_relative = rdata->current_dir + 1;
const char *filename = (char*) scan->data;
@@ -7022,36 +6965,27 @@
new_path = g_build_filename (tmp_dir, rdata->current_dir, rdata->new_name, common, NULL);
if (! rdata->is_dir) {
- char *e_old_path, *e_new_path;
-
- e_old_path = shell_escape (old_path);
- e_new_path = shell_escape (new_path);
-
fr_process_begin_command (archive->process, "mv");
fr_process_add_arg (archive->process, "-f");
- fr_process_add_arg (archive->process, e_old_path);
- fr_process_add_arg (archive->process, e_new_path);
+ fr_process_add_arg (archive->process, old_path);
+ fr_process_add_arg (archive->process, new_path);
fr_process_end_command (archive->process);
-
- g_free (e_old_path);
- g_free (e_new_path);
}
- new_file_list = g_list_prepend (new_file_list, g_build_filename (current_dir_relative, new_name_uri, common, NULL));
+ new_file_list = g_list_prepend (new_file_list, g_build_filename (current_dir_relative, rdata->new_name, common, NULL));
g_free (old_path);
g_free (common);
g_free (new_path);
}
new_file_list = g_list_reverse (new_file_list);
-
- g_free (new_name_uri);
fr_archive_add (archive,
new_file_list,
tmp_dir,
NULL,
FALSE,
+ TRUE,
window->priv->password,
window->priv->compression);
@@ -7064,13 +6998,12 @@
fr_process_set_working_dir (archive->process, g_get_tmp_dir ());
fr_process_set_sticky (archive->process, TRUE);
fr_process_add_arg (archive->process, "-rf");
- fr_process_add_arg (archive->process, e_tmp_dir);
+ fr_process_add_arg (archive->process, tmp_dir);
fr_process_end_command (archive->process);
fr_process_start (archive->process);
g_free (tmp_dir);
- g_free (e_tmp_dir);
}
@@ -7395,7 +7328,6 @@
{
const char *current_dir_relative = data->current_dir + 1;
GList *scan;
- char *e_tmp_dir;
GList *new_file_list = NULL;
if (window->priv->password_for_paste != NULL) {
@@ -7411,19 +7343,14 @@
/* skip folders */
if ((strcmp (old_name, new_name) != 0)
- && (old_name[strlen (old_name) - 1] != '/')) {
- char *e_old_name = shell_escape (old_name);
- char *e_new_name = shell_escape (new_name);
-
+ && (old_name[strlen (old_name) - 1] != '/'))
+ {
fr_process_begin_command (window->archive->process, "mv");
fr_process_set_working_dir (window->archive->process, data->tmp_dir);
fr_process_add_arg (window->archive->process, "-f");
- fr_process_add_arg (window->archive->process, e_old_name);
- fr_process_add_arg (window->archive->process, e_new_name);
+ fr_process_add_arg (window->archive->process, old_name);
+ fr_process_add_arg (window->archive->process, new_name);
fr_process_end_command (window->archive->process);
-
- g_free (e_old_name);
- g_free (e_new_name);
}
new_file_list = g_list_prepend (new_file_list, new_name);
@@ -7434,6 +7361,7 @@
data->tmp_dir,
NULL,
FALSE,
+ FALSE,
window->priv->password,
window->priv->compression);
@@ -7441,14 +7369,12 @@
/* remove the tmp dir */
- e_tmp_dir = shell_escape (data->tmp_dir);
fr_process_begin_command (window->archive->process, "rm");
fr_process_set_working_dir (window->archive->process, g_get_tmp_dir ());
fr_process_set_sticky (window->archive->process, TRUE);
fr_process_add_arg (window->archive->process, "-rf");
- fr_process_add_arg (window->archive->process, e_tmp_dir);
+ fr_process_add_arg (window->archive->process, data->tmp_dir);
fr_process_end_command (window->archive->process);
- g_free (e_tmp_dir);
fr_process_start (window->archive->process);
}
@@ -7683,11 +7609,8 @@
cdata->process->term_on_stop = FALSE;
fr_process_begin_command (cdata->process, command);
- for (scan = file_list; scan; scan = scan->next) {
- char *filename = shell_escape (scan->data);
- fr_process_add_arg (cdata->process, filename);
- g_free (filename);
- }
+ for (scan = file_list; scan; scan = scan->next)
+ fr_process_add_arg (cdata->process, scan->data);
fr_process_end_command (cdata->process);
CommandList = g_list_prepend (CommandList, cdata);
@@ -7806,6 +7729,7 @@
file->temp_dir,
"/",
FALSE,
+ FALSE,
window->priv->password,
window->priv->compression);
g_list_free (file_list);
Modified: trunk/src/fr-window.h
==============================================================================
--- trunk/src/fr-window.h (original)
+++ trunk/src/fr-window.h Tue Jun 10 17:04:20 2008
@@ -129,7 +129,6 @@
const char *base_dir,
const char *dest_dir,
gboolean update,
- gboolean recursive,
gboolean follow_links);
void fr_window_archive_add_directory (FrWindow *window,
const char *directory,
Modified: trunk/src/glib-utils.c
==============================================================================
--- trunk/src/glib-utils.c (original)
+++ trunk/src/glib-utils.c Tue Jun 10 17:04:20 2008
@@ -632,3 +632,16 @@
return result;
}
+
+
+char*
+g_uri_display_basename (const char *uri)
+{
+ char *e_name, *name;
+
+ e_name = g_filename_display_basename (uri);
+ name = g_uri_unescape_string (e_name, "");
+ g_free (e_name);
+
+ return name;
+}
Modified: trunk/src/glib-utils.h
==============================================================================
--- trunk/src/glib-utils.h (original)
+++ trunk/src/glib-utils.h Tue Jun 10 17:04:20 2008
@@ -66,6 +66,7 @@
gpointer user_data);
void g_ptr_array_reverse (GPtrArray *array);
const char * get_static_string (const char *s);
+char* g_uri_display_basename (const char *uri);
/**/
Modified: trunk/src/main.c
==============================================================================
--- trunk/src/main.c (original)
+++ trunk/src/main.c Tue Jun 10 17:04:20 2008
@@ -384,8 +384,8 @@
char *e1;
char *e2;
- e1 = shell_escape (from_path);
- e2 = shell_escape (to_path);
+ e1 = g_shell_quote (from_path);
+ e2 = g_shell_quote (to_path);
line = g_strdup_printf ("mv -f %s %s", e1, e2);
g_free (e1);
g_free (e2);
@@ -414,8 +414,8 @@
char *e1;
char *e2;
- e1 = shell_escape (from_path);
- e2 = shell_escape (to_path);
+ e1 = g_shell_quote (from_path);
+ e2 = g_shell_quote (to_path);
line = g_strdup_printf ("mv -f %s %s", e1, e2);
g_free (e1);
g_free (e2);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]