ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andy Stevens <insomniacpeng...@googlemail.com>
Subject Re: Folder-Comments
Date Thu, 24 Sep 2009 23:04:52 GMT
2009/9/22 Arne v.Irmer <Arne.vonIrmer@tu-dortmund.de>:
> Hi,
> with the command line program "zip" I can create a zip-File with annotated folders inside.
I try to generate such a zip-File with the org.apache.tools.zip classes coming with ant.jar.
>
> Here is my small example program:
>
> package org.example.zip;
>
> import java.io.BufferedOutputStream;
> import java.io.FileOutputStream;
>
> import org.apache.tools.zip.ZipEntry;
> import org.apache.tools.zip.ZipOutputStream;
>
> public class ZipTest {
>        public static void main (String argv[]) {
>                try {
>                        FileOutputStream dest = new FileOutputStream("/tmp/checkFolder.zip");
>                        ZipOutputStream out = new ZipOutputStream(new BufferedOutputStream(dest));
>
>                        ZipEntry folderEntry = new ZipEntry("TestFolder");

In the souce code for ZipEntry I see
     public boolean isDirectory() {
         return getName().endsWith("/");
     }
so I expect that should be new ZipEntry("TestFolder/")...
"TestFolder" is a perfectly valid name for a file - extensions aren't
mandatory, especially on non-windows systems.  The fact you don't call
out.write() for folderEntry explains why it then has a length of 0,
but asides from that it looks to me that you're creating two files,
one of which happens to be in a folder with the same name as the first
one (hence the errors you get when unzipping).

I'm curious what exactly this has to do with Ant, though?


Andy
-- 
http://pseudoq.sourceforge.net/  open source java sudoku application

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message