file-roller r2466 - in trunk: . src
- From: paobac svn gnome org
- To: svn-commits-list gnome org
- Subject: file-roller r2466 - in trunk: . src
- Date: Sun, 7 Sep 2008 06:49:42 +0000 (UTC)
Author: paobac
Date: Sun Sep 7 06:49:42 2008
New Revision: 2466
URL: http://svn.gnome.org/viewvc/file-roller?rev=2466&view=rev
Log:
2008-09-07 Paolo Bacchilega <paobac svn gnome org>
* src/fr-command-rpm.c:
* src/fr-command-cpio.c:
Fixed bug #551153 â [PATCH] rpm: display empty directories and support
device files.
Patch by Eric Piel.
Fixed bug #551146 â [PATCH] cpio: escaped filenames and block devices
support.
Patch by Eric Piel.
Modified:
trunk/ChangeLog
trunk/src/fr-command-cpio.c
trunk/src/fr-command-rpm.c
Modified: trunk/src/fr-command-cpio.c
==============================================================================
--- trunk/src/fr-command-cpio.c (original)
+++ trunk/src/fr-command-cpio.c Sun Sep 7 06:49:42 2008
@@ -92,6 +92,7 @@
FrCommand *comm = FR_COMMAND (data);
char **fields;
const char *name_field;
+ char *name;
int ofs = 0;
g_return_if_fail (line != NULL);
@@ -106,15 +107,17 @@
name_field = get_last_field (line, 10);
#else /* !__sun */
- if (line[0] == 'c') {
+ /* Handle char and block device files */
+ if ((line[0] == 'c') || (line[0] == 'b')) {
fields = split_line (line, 9);
ofs = 1;
+ fdata->size = 0;
+ /* FIXME: We should also specify the content type */
}
else {
fields = split_line (line, 8);
- ofs = 0;
+ fdata->size = g_ascii_strtoull (fields[4], NULL, 10);
}
- fdata->size = g_ascii_strtoull (fields[4+ofs], NULL, 10);
fdata->modified = mktime_from_string (fields[5+ofs], fields[6+ofs], fields[7+ofs]);
g_strfreev (fields);
@@ -130,33 +133,27 @@
fdata->dir = line[0] == 'd';
+ name = g_strcompress (fields[0]);
if (*(fields[0]) == '/') {
- char *name = fields[0];
- if (fdata->dir && (name[strlen (name) - 1] != '/')) {
- fdata->full_path = g_strconcat (name, "/", NULL);
- fdata->original_path = g_strdup (fields[0]);
- fdata->free_original_path = TRUE;
- }
- else {
- fdata->full_path = g_strdup (fields[0]);
- fdata->original_path = fdata->full_path;
- }
+ fdata->full_path = g_strdup (name);
+ fdata->original_path = fdata->full_path;
}
else {
- char *name = fields[0];
- if (fdata->dir && (name[strlen (name) - 1] != '/')) {
- fdata->full_path = g_strconcat ("/", name, "/", NULL);
- fdata->original_path = g_strdup (fields[0]);
- fdata->free_original_path = TRUE;
- }
- else {
- fdata->full_path = g_strconcat ("/", fields[0], NULL);
- fdata->original_path = fdata->full_path + 1;
- }
+ fdata->full_path = g_strconcat ("/", name, NULL);
+ fdata->original_path = fdata->full_path + 1;
}
+ if (fdata->dir && (name[strlen (name) - 1] != '/')) {
+ char *old_full_path = fdata->full_path;
+ fdata->full_path = g_strconcat (old_full_path, "/", NULL);
+ g_free (old_full_path);
+ fdata->original_path = g_strdup (name);
+ fdata->free_original_path = TRUE;
+ }
+ g_free (name);
+
if (fields[1] != NULL)
- fdata->link = g_strdup (fields[1]);
+ fdata->link = g_strcompress (fields[1]);
g_strfreev (fields);
if (fdata->dir)
@@ -175,18 +172,11 @@
static void
fr_command_cpio_list (FrCommand *comm)
{
- GString *cmd;
-
fr_process_set_out_line_func (comm->process, list__process_line, comm);
fr_process_begin_command (comm->process, "sh");
fr_process_add_arg (comm->process, "-c");
-
- cmd = g_string_new ("cpio -itv < ");
- g_string_append (cmd, comm->e_filename);
- fr_process_add_arg (comm->process, cmd->str);
- g_string_free (cmd, TRUE);
-
+ fr_process_add_arg_concat (comm->process, "cpio -itv < ", comm->e_filename, NULL);
fr_process_end_command (comm->process);
fr_process_start (comm->process);
}
@@ -205,10 +195,10 @@
GString *cmd;
fr_process_begin_command (comm->process, "sh");
- fr_process_add_arg (comm->process, "-c");
if (dest_dir != NULL)
fr_process_set_working_dir (comm->process, dest_dir);
-
+ fr_process_add_arg (comm->process, "-c");
+
cmd = g_string_new ("cpio -idu ");
for (scan = file_list; scan; scan = scan->next) {
char *filename = g_shell_quote (scan->data);
Modified: trunk/src/fr-command-rpm.c
==============================================================================
--- trunk/src/fr-command-rpm.c (original)
+++ trunk/src/fr-command-rpm.c Sun Sep 7 06:49:42 2008
@@ -92,12 +92,11 @@
FrCommand *comm = FR_COMMAND (data);
char **fields;
const char *name_field;
+ char *name;
+ int ofs = 0;
g_return_if_fail (line != NULL);
- if (line[0] == 'd') /* Ignore directories. */
- return;
-
fdata = file_data_new ();
#ifdef __sun
@@ -107,14 +106,23 @@
g_strfreev (fields);
name_field = get_last_field (line, 10);
-#else
- fields = split_line (line, 8);
- fdata->size = g_ascii_strtoull (fields[4], NULL, 10);
- fdata->modified = mktime_from_string (fields[5], fields[6], fields[7]);
+#else /* !__sun */
+ /* Handle char and block device files */
+ if ((line[0] == 'c') || (line[0] == 'b')) {
+ fields = split_line (line, 9);
+ ofs = 1;
+ fdata->size = 0;
+ /* TODO We should also specify the content type */
+ }
+ else {
+ fields = split_line (line, 8);
+ fdata->size = g_ascii_strtoull (fields[4], NULL, 10);
+ }
+ fdata->modified = mktime_from_string (fields[5+ofs], fields[6+ofs], fields[7+ofs]);
g_strfreev (fields);
- name_field = get_last_field (line, 9);
-#endif /* __sun */
+ name_field = get_last_field (line, 9+ofs);
+#endif /* !__sun */
fields = g_strsplit (name_field, " -> ", 2);
@@ -123,25 +131,34 @@
fields = g_strsplit (name_field, " link to ", 2);
}
+ fdata->dir = line[0] == 'd';
+
+ name = g_strcompress (fields[0]);
if (*(fields[0]) == '/') {
- fdata->full_path = g_strcompress (fields[0]);
+ fdata->full_path = g_strdup (name);
fdata->original_path = fdata->full_path;
}
else {
- char *compressed;
-
- compressed = g_strcompress (fields[0]);
- fdata->full_path = g_strconcat ("/", compressed, NULL);
- g_free (compressed);
-
+ fdata->full_path = g_strconcat ("/", name, NULL);
fdata->original_path = fdata->full_path + 1;
}
+ if (fdata->dir && (name[strlen (name) - 1] != '/')) {
+ char *old_full_path = fdata->full_path;
+ fdata->full_path = g_strconcat (old_full_path, "/", NULL);
+ g_free (old_full_path);
+ fdata->original_path = g_strdup (name);
+ fdata->free_original_path = TRUE;
+ }
+ g_free (name);
if (fields[1] != NULL)
fdata->link = g_strcompress (fields[1]);
g_strfreev (fields);
- fdata->name = g_strdup (file_name_from_path (fdata->full_path));
+ if (fdata->dir)
+ fdata->name = dir_name_from_path (fdata->full_path);
+ else
+ fdata->name = g_strdup (file_name_from_path (fdata->full_path));
fdata->path = remove_level_from_path (fdata->full_path);
if (*fdata->name == 0)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]