[kaffe] CVS kaffe (guilhem): Fixes for jar

Kaffe CVS cvs-commits at kaffe.org
Fri Jul 22 00:30:49 PDT 2005


PatchSet 6757 
Date: 2005/07/22 07:25:11
Author: guilhem
Branch: HEAD
Tag: (none) 
Log:
Fixes for jar

2005-07-21  Kurt Miller <truk at optonline.net>

	* libraries/javalib/kaffe/tools/jar/Jar.java
	(listFilesInJar,extractFilesInJar): Handle correctly -t and -x arguments.

Members: 
	ChangeLog:1.4282->1.4283 
	libraries/javalib/kaffe/tools/jar/Jar.java:1.9->1.10 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.4282 kaffe/ChangeLog:1.4283
--- kaffe/ChangeLog:1.4282	Thu Jul 21 17:56:19 2005
+++ kaffe/ChangeLog	Fri Jul 22 07:25:11 2005
@@ -1,3 +1,8 @@
+2005-07-21  Kurt Miller <truk at optonline.net>
+
+	* libraries/javalib/kaffe/tools/jar/Jar.java
+	(listFilesInJar,extractFilesInJar): Handle correctly -t and -x arguments.
+
 2005-07-21  Guilhem Lavaux  <guilhem at kaffe.org>
 
 	* WHATSNEW, TODO: Updated.
Index: kaffe/libraries/javalib/kaffe/tools/jar/Jar.java
diff -u kaffe/libraries/javalib/kaffe/tools/jar/Jar.java:1.9 kaffe/libraries/javalib/kaffe/tools/jar/Jar.java:1.10
--- kaffe/libraries/javalib/kaffe/tools/jar/Jar.java:1.9	Sun Jun 26 01:21:53 2005
+++ kaffe/libraries/javalib/kaffe/tools/jar/Jar.java	Fri Jul 22 07:25:14 2005
@@ -642,8 +642,8 @@
 
 
 		// see if the current ZipEntry's name equals 
-		// the file we want to extract. If equal then
-		// print the name of the file to stdout.
+		// the file we want to extract or if it starts
+		// with a path matching the dir we want to extract.
 
 		String entry_name = entry.getName();
 		boolean match = (shortnames == null);
@@ -657,6 +657,17 @@
 		    for (int i = 0; i < shortnames.length ; i++) {
 			if (entry_name.equals(shortnames[i])) {
 			    match = true;
+			    break;
+			} else if (shortnames[i].endsWith("/")) {
+			    if (entry_name.startsWith(shortnames[i])) {
+				match = true;
+				break;
+			    }
+			} else {
+			    if (entry_name.startsWith(shortnames[i] + '/')) { 
+				match = true;
+				break;
+			    }
 			}
 		    }
 		}
@@ -752,6 +763,20 @@
 			if (entry_name.equals(shortnames[i])) {
 			    match = true;
 			    longname = longnames[i];
+			    break;
+			} else if (shortnames[i].endsWith("/")) {
+			    if (entry_name.startsWith(shortnames[i])) {
+				String shortname = shortnames[i].substring(0, shortnames[i].length() -1);
+				match = true;
+				longname = longnames[i].substring(0, longnames[i].lastIndexOf(shortname)) + entry_name;
+				break;
+			    }
+			} else {
+			    if (entry_name.startsWith(shortnames[i] + '/')) { 
+				match = true;
+				longname = longnames[i].substring(0, longnames[i].lastIndexOf(shortnames[i])) + entry_name;
+				break;
+			    }
 			}
 		    }
 		}



More information about the kaffe mailing list