file-roller r2319 - in trunk: . src
- From: paobac svn gnome org
- To: svn-commits-list gnome org
- Subject: file-roller r2319 - in trunk: . src
- Date: Wed, 11 Jun 2008 11:26:56 +0000 (UTC)
Author: paobac
Date: Wed Jun 11 11:26:55 2008
New Revision: 2319
URL: http://svn.gnome.org/viewvc/file-roller?rev=2319&view=rev
Log:
2008-06-11 Paolo Bacchilega <paobac svn gnome org>
* src/open-file.c (open_file_new): return null if the files doesn't
exists.
* src/fr-window.c (monitor_extracted_files): don't add the file if
it's NULL.
* src/fr-command-cpio.c (fr_command_cpio_list, fr_command_cpio_extract):
insert the pipe in a single argument.
* src/fr-command-cfile.c:
fixed misc errors.
* src/file-utils.h:
* src/file-utils.c:
added function get_file_size_for_path()
Modified:
trunk/ChangeLog
trunk/src/file-utils.c
trunk/src/file-utils.h
trunk/src/fr-command-cfile.c
trunk/src/fr-command-cpio.c
trunk/src/fr-window.c
trunk/src/open-file.c
Modified: trunk/src/file-utils.c
==============================================================================
--- trunk/src/file-utils.c (original)
+++ trunk/src/file-utils.c Wed Jun 11 11:26:55 2008
@@ -329,6 +329,20 @@
}
+goffset
+get_file_size_for_path (const char *path)
+{
+ char *uri;
+ goffset result;
+
+ uri = g_filename_to_uri (path, NULL, NULL);
+ result = get_file_size (uri);
+ g_free (uri);
+
+ return result;
+}
+
+
static time_t
get_file_time_type (const char *uri,
const char *type)
Modified: trunk/src/file-utils.h
==============================================================================
--- trunk/src/file-utils.h (original)
+++ trunk/src/file-utils.h Wed Jun 11 11:26:55 2008
@@ -48,6 +48,7 @@
gboolean path_in_path (const char *path_src,
const char *path_dest);
goffset get_file_size (const char *uri);
+goffset get_file_size_for_path (const char *path);
time_t get_file_mtime (const char *uri);
time_t get_file_mtime_for_path (const char *path);
time_t get_file_ctime (const char *uri);
Modified: trunk/src/fr-command-cfile.c
==============================================================================
--- trunk/src/fr-command-cfile.c (original)
+++ trunk/src/fr-command-cfile.c Wed Jun 11 11:26:55 2008
@@ -43,17 +43,17 @@
static char *
get_uncompressed_name_from_archive (FrCommand *comm,
- const char *e_filename)
+ const char *archive)
{
int fd;
char buffer[11];
char *filename = NULL;
GString *str = NULL;
- if (is_mime_type (comm->mime_type, "application/x-gzip"))
+ if (! is_mime_type (comm->mime_type, "application/x-gzip"))
return NULL;
- fd = open (e_filename, O_RDONLY);
+ fd = open (archive, O_RDONLY);
if (fd < 0)
return NULL;
@@ -178,7 +178,7 @@
fdata->original_path = fdata->full_path + 1;
fdata->link = NULL;
- fdata->size = get_file_size (comm->filename);
+ fdata->size = get_file_size_for_path (comm->filename);
fdata->modified = get_file_mtime_for_path (comm->filename);
fdata->name = g_strdup (file_name_from_path (fdata->full_path));
@@ -382,8 +382,6 @@
"/",
compr_file,
NULL);
- g_free (compr_file);
- g_free (dest_file);
fr_process_begin_command (comm->process, "cp");
fr_process_add_arg (comm->process, "-f");
@@ -399,6 +397,8 @@
fr_process_add_arg (comm->process, temp_dir);
fr_process_end_command (comm->process);
+ g_free (dest_file);
+ g_free (compr_file);
g_free (uncompr_file);
g_free (temp_file);
g_free (temp_dir);
Modified: trunk/src/fr-command-cpio.c
==============================================================================
--- trunk/src/fr-command-cpio.c (original)
+++ trunk/src/fr-command-cpio.c Wed Jun 11 11:26:55 2008
@@ -149,14 +149,20 @@
fr_command_cpio_list (FrCommand *comm,
const char *password)
{
+ GString *cmd;
+
fr_process_set_out_line_func (FR_COMMAND (comm)->process,
list__process_line,
comm);
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);
+
+ 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_end_command (comm->process);
fr_process_start (comm->process);
}
@@ -171,17 +177,26 @@
gboolean junk_paths,
const char *password)
{
- GList *scan;
+ GList *scan;
+ GString *cmd;
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)
- fr_process_add_arg (comm->process, scan->data);
- fr_process_add_arg (comm->process, "<");
- fr_process_add_arg (comm->process, comm->e_filename);
+
+ cmd = g_string_new ("cpio -idu ");
+ for (scan = file_list; scan; scan = scan->next) {
+ char *filename = g_shell_quote (scan->data);
+ g_string_append (cmd, filename);
+ g_free (filename);
+ g_string_append (cmd, " ");
+ }
+ g_string_append (cmd, " < ");
+ g_string_append (cmd, comm->e_filename);
+ fr_process_add_arg (comm->process, cmd->str);
+ g_string_free (cmd, TRUE);
+
fr_process_end_command (comm->process);
fr_process_start (comm->process);
}
@@ -195,7 +210,7 @@
comm->capabilities |= FR_COMMAND_CAP_ARCHIVE_MANY_FILES;
if (is_program_in_path ("cpio"))
- comm->capabilities |= FR_COMMAND_CAP_READ_WRITE;
+ comm->capabilities |= FR_COMMAND_CAP_READ;
}
Modified: trunk/src/fr-window.c
==============================================================================
--- trunk/src/fr-window.c (original)
+++ trunk/src/fr-window.c Wed Jun 11 11:26:55 2008
@@ -7814,7 +7814,8 @@
const char *extracted_path = scan2->data;
ofile = open_file_new (file, extracted_path, odata->cdata->temp_dir);
- fr_window_monitor_open_file (window, ofile);
+ if (ofile != NULL)
+ fr_window_monitor_open_file (window, ofile);
}
}
Modified: trunk/src/open-file.c
==============================================================================
--- trunk/src/open-file.c (original)
+++ trunk/src/open-file.c Wed Jun 11 11:26:55 2008
@@ -35,6 +35,10 @@
ofile = g_new0 (OpenFile, 1);
ofile->path = g_strdup (path);
ofile->extracted_uri = g_filename_to_uri (extracted_path, NULL, NULL);
+ if (! uri_exists (ofile->extracted_uri)) {
+ open_file_free (ofile);
+ return NULL;
+ }
ofile->temp_dir = g_strdup (temp_dir);
ofile->last_modified = get_file_mtime (ofile->extracted_uri);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]