[Xfce4-commits] r26066 - xarchiver/trunk/src

Giuseppe Torelli colossus at xfce.org
Mon Sep 10 16:17:14 CEST 2007


Author: colossus
Date: 2007-09-10 14:17:14 +0000 (Mon, 10 Sep 2007)
New Revision: 26066

Modified:
   xarchiver/trunk/src/archive.c
   xarchiver/trunk/src/archive.h
   xarchiver/trunk/src/extract_dialog.c
   xarchiver/trunk/src/lzma.c
   xarchiver/trunk/src/window.c
Log:
Initial workaround for extracting tar archive files without path; but the end is still far...
Fixed missed detection for lzma archives.


Modified: xarchiver/trunk/src/archive.c
===================================================================
--- xarchiver/trunk/src/archive.c	2007-09-10 12:04:49 UTC (rev 26065)
+++ xarchiver/trunk/src/archive.c	2007-09-10 14:17:14 UTC (rev 26066)
@@ -423,6 +423,7 @@
 			last_entry = xa_alloc_memory_for_each_row(archive->nc,archive->column_types);
 			last_entry->filename = g_strdup(full_path_name);
 			last_entry->columns = xa_fill_archive_entry_columns_for_each_row(archive,last_entry,items);
+			last_entry->prev = NULL;
 			last_entry->is_dir = TRUE;
 			archive->entries = g_slist_prepend (archive->entries,last_entry);
 			archive->nr_of_dirs++;
@@ -438,6 +439,7 @@
 				child_entry = xa_alloc_memory_for_each_row (archive->nc,archive->column_types);
 				child_entry->filename = g_strdup(full_path_name);
 				child_entry->columns = xa_fill_archive_entry_columns_for_each_row(archive,child_entry,items);
+				child_entry->prev = last_entry;
 				child_entry->is_dir = TRUE;
 
 				child_entry->next = last_entry->child;
@@ -462,6 +464,7 @@
 
 			child_entry->next = last_entry->child;
 			last_entry->child = child_entry;
+			child_entry->prev = last_entry;
 		}
 	}
 	else
@@ -641,3 +644,13 @@
 	}
 }
 
+gchar *xa_build_pathname_from_entries (XArchive *archive,XEntry *entry)
+{
+	while (entry)
+	{
+		g_print ("%s\n",entry->filename);
+		entry = entry->prev;
+	}
+	g_print ("\n");
+	return NULL;
+}

Modified: xarchiver/trunk/src/archive.h
===================================================================
--- xarchiver/trunk/src/archive.h	2007-09-10 12:04:49 UTC (rev 26065)
+++ xarchiver/trunk/src/archive.h	2007-09-10 14:17:14 UTC (rev 26066)
@@ -59,6 +59,7 @@
 	gboolean is_encrypted;
 	XEntry *child;
 	XEntry *next;
+	XEntry *prev;
 };
 
 typedef struct _XArchive XArchive;
@@ -131,6 +132,7 @@
 XEntry *xa_set_archive_entries_for_each_row (XArchive *archive,gchar *filename,gboolean encrypted,gpointer *items);
 gpointer *xa_fill_archive_entry_columns_for_each_row (XArchive *archive,XEntry *entry,gpointer *items);
 void xa_update_window_with_archive_entries (XArchive *archive,gchar *path);
+gchar *xa_build_pathname_from_entries (XArchive *archive,XEntry *entry);
 XArchive *archive[100];
 XArchive *archive_cmd;
 #endif

Modified: xarchiver/trunk/src/extract_dialog.c
===================================================================
--- xarchiver/trunk/src/extract_dialog.c	2007-09-10 12:04:49 UTC (rev 26065)
+++ xarchiver/trunk/src/extract_dialog.c	2007-09-10 14:17:14 UTC (rev 26066)
@@ -824,11 +824,14 @@
 		/* *Here we have to fill a GSList with all the filenames in the archive so that we can use mv on all of them */
 		XEntry *entry;
 		GSList *s = archive->entries;
-		g_print ("%s\n",gtk_entry_get_text(GTK_ENTRY(location_entry)));
+		//g_print ("%s\n",gtk_entry_get_text(GTK_ENTRY(location_entry)));
 		for (; s; s = s->next)
 		{
 			entry = s->data;
-			xa_store_entries_in_gslist(entry,&xxx);
+			XEntry *p = xa_find_archive_entry(s->data,entry->filename);
+			g_print ("Ho trovato: %s\n",p->filename);
+			xa_build_pathname_from_entries (archive,p);
+			//xa_store_entries_in_gslist(entry,&xxx);
 		}
 	}
 	filenames = g_slist_reverse(xxx);

Modified: xarchiver/trunk/src/lzma.c
===================================================================
--- xarchiver/trunk/src/lzma.c	2007-09-10 12:04:49 UTC (rev 26065)
+++ xarchiver/trunk/src/lzma.c	2007-09-10 14:17:14 UTC (rev 26066)
@@ -38,11 +38,11 @@
 
 	if ( g_str_has_suffix ( archive->escaped_path , ".tar.lzma") || g_str_has_suffix ( archive->escaped_path , ".tlz") )
 	{
-    gchar *tar;
+    	gchar *tar;
+	    tar = g_find_program_in_path ("gtar");
 
-    tar = g_find_program_in_path ("gtar");
-    if (tar == NULL)
-      tar = g_strdup ("tar");
+		if (tar == NULL)
+			tar = g_strdup ("tar");
 
 		command = g_strconcat (tar, " tv --use-compress-program=lzma -f " , archive->escaped_path, NULL );
 		archive->dummy_size = 0;

Modified: xarchiver/trunk/src/window.c
===================================================================
--- xarchiver/trunk/src/window.c	2007-09-10 12:04:49 UTC (rev 26065)
+++ xarchiver/trunk/src/window.c	2007-09-10 14:17:14 UTC (rev 26066)
@@ -1075,12 +1075,12 @@
 	else if ( memcmp ( magic,"\x60\xea",2 ) == 0 )
 		xx = XARCHIVETYPE_ARJ;
 	else if ( memcmp ( magic,"\x52\x61\x72\x21",4 ) == 0 )
-		 xx = XARCHIVETYPE_RAR;
+		xx = XARCHIVETYPE_RAR;
 	else if ( memcmp ( magic,"\x42\x5a\x68",3 ) == 0 )
 		xx = XARCHIVETYPE_BZIP2;
 	else if ( memcmp ( magic,"\x1f\x8b",2) == 0 || memcmp ( magic,"\x1f\x9d",2 ) == 0 )
 		xx = XARCHIVETYPE_GZIP;
-	else if ( memcmp ( magic,"\x00\x5d\x80\x00",4 ) == 0 )
+	else if ( memcmp ( magic,"\x5d\x00\x00\x80",4 ) == 0 )
 		xx = XARCHIVETYPE_LZMA;
 	else if ( memcmp ( magic,"\xed\xab\xee\xdb",4 ) == 0 )
 		xx = XARCHIVETYPE_RPM;



More information about the Xfce4-commits mailing list