Hi, the attached patch removes the dreaded dot - file separator prefixes from files which should be added to zip (jar) archives. This fixes 32516[0] for me.
ChangeLog:
2007-12-10 Robert Schuster <[EMAIL PROTECTED]>
PR classpath/32516:
* tools/gnu/classpath/tools/jar/Entry.java:
(Entry(File, String)): Added loop to remove all dot-file separator
prefixes.
(Entry(File)): Call Entry(File, String) constructor variant.
[0] - http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32516
Index: tools/gnu/classpath/tools/jar/Entry.java
===================================================================
RCS file: /sources/classpath/classpath/tools/gnu/classpath/tools/jar/Entry.java,v
retrieving revision 1.1
diff -u -r1.1 Entry.java
--- tools/gnu/classpath/tools/jar/Entry.java 8 May 2006 18:38:20 -0000 1.1
+++ tools/gnu/classpath/tools/jar/Entry.java 10 Dec 2007 19:46:18 -0000
@@ -49,12 +49,22 @@
public Entry(File file, String name)
{
this.file = file;
- this.name = name;
+
+ /* Removes any './' prefixes automatically. Those caused trouble
+ * in (boot) classpath use-cases. See #32516.
+ */
+ int start = 0;
+ while (name.length() > start + 2
+ && name.codePointAt(start) == '.'
+ && name.codePointAt(start + 1) == File.separatorChar)
+ start += 2;
+
+ this.name = name.substring(start);
}
public Entry(File file)
{
- this.file = file;
- this.name = file.toString();
+ this(file, file.toString());
}
+
}
signature.asc
Description: OpenPGP digital signature
