file-roller r2315 - in trunk: . src



Author: paobac
Date: Wed Jun 11 09:11:04 2008
New Revision: 2315
URL: http://svn.gnome.org/viewvc/file-roller?rev=2315&view=rev

Log:
2008-06-11  Paolo Bacchilega  <paobac svn gnome org>

	* src/glib-utils.h: 
	* src/glib-utils.c: 
	* src/fr-window.c: 
	* src/fr-command-tar.c: 
	* src/fr-archive.c: 

	uri_escape the file list before passing it to fr_archive_add.


Modified:
   trunk/ChangeLog
   trunk/TODO
   trunk/src/fr-archive.c
   trunk/src/fr-command-tar.c
   trunk/src/fr-window.c
   trunk/src/glib-utils.c
   trunk/src/glib-utils.h

Modified: trunk/TODO
==============================================================================
--- trunk/TODO	(original)
+++ trunk/TODO	Wed Jun 11 09:11:04 2008
@@ -21,6 +21,8 @@
 
 [ ] #521324 â ALZ archive support
 
+[ ] #482560 â totem-like plugin installer for file-roller
+
 == Done ==
 
 [x] implement the tree_view context menu commands.

Modified: trunk/src/fr-archive.c
==============================================================================
--- trunk/src/fr-archive.c	(original)
+++ trunk/src/fr-archive.c	Wed Jun 11 09:11:04 2008
@@ -1309,7 +1309,7 @@
 		char *uri = scan->data;
 		char *local_filename;
 		
-		local_filename = g_uri_unescape_string (uri, NULL);
+		local_filename = g_uri_unescape_string (uri, G_URI_RESERVED_CHARS_ALLOWED_IN_PATH);
 		if (local_filename != NULL)
 			local_file_list = g_list_prepend (local_file_list, local_filename);
 	}

Modified: trunk/src/fr-command-tar.c
==============================================================================
--- trunk/src/fr-command-tar.c	(original)
+++ trunk/src/fr-command-tar.c	Wed Jun 11 09:11:04 2008
@@ -133,10 +133,12 @@
 
 	g_return_if_fail (line != NULL);
 
-	fdata = file_data_new ();
-
 	date_idx = file_list__get_index_from_pattern (line, "%n%n%n%n-%n%n-%n%n %n%n:%n%n");
+	if (date_idx < 0)
+		return;
 
+	fdata = file_data_new ();
+		
 	field_size = file_list__get_prev_field (line, date_idx, 1);
 	fdata->size = g_ascii_strtoull (field_size, NULL, 10);
 	g_free (field_size);
@@ -157,7 +159,7 @@
 		fields = g_strsplit (field_name, " link to ", 2);
 	}
 
-	name = unescape_str (fields[0]);
+	name = g_strcompress (fields[0]);
 	if (*name == '/') {
 		fdata->full_path = g_strdup (name);
 		fdata->original_path = fdata->full_path;

Modified: trunk/src/fr-window.c
==============================================================================
--- trunk/src/fr-window.c	(original)
+++ trunk/src/fr-window.c	Wed Jun 11 09:11:04 2008
@@ -6957,7 +6957,8 @@
 		const char *current_dir_relative = rdata->current_dir + 1;
 		const char *filename = (char*) scan->data;
 		char       *old_path = NULL, *common = NULL, *new_path = NULL;
-
+		char       *new_filename;
+		
 		old_path = g_build_filename (tmp_dir, filename, NULL);
 
 		if (strlen (filename) > (strlen (rdata->current_dir) + strlen (rdata->old_name)))
@@ -6972,8 +6973,10 @@
 			fr_process_end_command (archive->process);
 		}
 
-		new_file_list = g_list_prepend (new_file_list, g_build_filename (current_dir_relative, rdata->new_name, common, NULL));
+		new_filename = g_build_filename (current_dir_relative, rdata->new_name, common, NULL);
+		new_file_list = g_list_prepend (new_file_list, g_uri_escape_string (new_filename, G_URI_RESERVED_CHARS_ALLOWED_IN_PATH, TRUE));
 
+		g_free (new_filename);
 		g_free (old_path);
 		g_free (common);
 		g_free (new_path);
@@ -7339,10 +7342,10 @@
 	for (scan = data->files; scan; scan = scan->next) {
 		const char *old_name = (char*) scan->data;
 		char       *new_name = g_build_filename (current_dir_relative, old_name + strlen (data->base_dir) - 1, NULL);
-
+		
 		/* skip folders */
 
-		if ((strcmp (old_name, new_name) != 0)
+		if ((strcmp (old_name, new_name) != 0) 
 		    && (old_name[strlen (old_name) - 1] != '/')) 
 		{
 			fr_process_begin_command (window->archive->process, "mv");
@@ -7353,7 +7356,8 @@
 			fr_process_end_command (window->archive->process);
 		}
 
-		new_file_list = g_list_prepend (new_file_list, new_name);
+		new_file_list = g_list_prepend (new_file_list, g_uri_escape_string (new_name, G_URI_RESERVED_CHARS_ALLOWED_IN_PATH, TRUE));
+		g_free (new_name);
 	}
   
 	fr_archive_add (window->archive,
@@ -7723,7 +7727,7 @@
 		OpenFile *file = scan->data;
 		GList    *file_list;
 		
-		file_list = g_list_append (NULL, file->path);
+		file_list = g_list_append (NULL, g_uri_escape_string (file->path, G_URI_RESERVED_CHARS_ALLOWED_IN_PATH, TRUE));
 		fr_archive_add (window->archive,
 				file_list,
 				file->temp_dir,
@@ -7732,7 +7736,7 @@
 				FALSE,
 				window->priv->password,
 				window->priv->compression);
-		g_list_free (file_list);
+		path_list_free (file_list);
 	}
 	
 	fr_process_start (window->archive->process);

Modified: trunk/src/glib-utils.c
==============================================================================
--- trunk/src/glib-utils.c	(original)
+++ trunk/src/glib-utils.c	Wed Jun 11 09:11:04 2008
@@ -159,32 +159,6 @@
 }
 
 
-/* remove backslashes from a string. */
-char*
-unescape_str (const char  *str)
-{
-	char       *new_str;
-	const char *s;
-	char       *t;
-
-	if (str == NULL)
-		return NULL;
-
-	new_str = g_malloc (strlen (str) + 1);
-
-	s = str;
-	t = new_str;
-	while (*s) {
-		if (*s == '\\')
-			s++;
-		*t++ = *s++;
-	}
-	*t = 0;
-
-	return new_str;
-}
-
-
 /* escape with backslash the file name. */
 char*
 shell_escape (const char *filename)

Modified: trunk/src/glib-utils.h
==============================================================================
--- trunk/src/glib-utils.h	(original)
+++ trunk/src/glib-utils.h	Wed Jun 11 09:11:04 2008
@@ -41,7 +41,6 @@
 						  const char  postfix);
 char*               escape_str                   (const char  *str,
 						  const char  *meta_chars);
-char*               unescape_str                 (const char  *str);
 gchar *             shell_escape                 (const gchar *filename);
 gboolean            match_regexps                (GRegex     **regexps,
 						  const char  *string,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]