You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Will Glozer <wi...@jda.com> on 2000/09/06 22:56:31 UTC

Zip task including dirs

Hello, I am wondering why the Zip (and thus Jar) tasks include all of the
parent
directories for each file?  It seems that the file would just need its full
path,
and not a separate zip entry for the directory itself.  This would make
viewing
the archives much easier and possibly even reduce their size.

I really like ant and kudos to the developers!  I just finished a major
build
system with it and not too many troubles =)

Thanks,
Will

Re: Zip task including dirs

Posted by Jesse Glick <Je...@netbeans.com>.
donaldp@mad.scientist.com wrote:
> 
> On Wed, 6 Sep 2000, Will Glozer wrote:
> 
> > Hello, I am wondering why the Zip (and thus Jar) tasks include all of the
> > parent
> > directories for each file?  It seems that the file would just need its full
> > path,
> > and not a separate zip entry for the directory itself.  This would make
> > viewing
> > the archives much easier and possibly even reduce their size.
> 
> I like that behaviour and need it or else I end up creating
> files in directories that's sole purpose is to ensure that
> dir gets created. I have done this a lot with OS level zip
> utilities and it suxs :<.

I sent the patch that ensures directories are added fairly recently and
it was committed. It is more consistent with the behavior e.g. of the
JDK jar tool, which always creates the parent dirs, and at least Linux
zip. It seems safer to put them in even if it does make a few more
entries in the archive; some readers of the archive may blithely assume
that parent dirs exist (as happened to me).

Note: the current Zip.java does not add directories that have no file in
them, even if they matched according to the fileset. I.e. it looks for
matching files only, then adds just their parents. This is arguably a
bug; I will try to send a patch to fix it if anyone is interested.

> An optional attribute that turned of this behaviour would be
> okay thou :P

This would be really easy if people wanted it--just add a new attribute
to Zip.java, and if set, then in zipDir() return without doing anything.
Again I will send a patch if there is interest.

-Jesse

-- 
Jesse Glick   <ma...@netbeans.com>
NetBeans, Open APIs  <http://www.netbeans.org/>
tel (+4202) 3300-9161 Sun Micro x49161 Praha CR

Re: Zip task including dirs

Posted by do...@mad.scientist.com.
On Wed, 6 Sep 2000, Will Glozer wrote:

> Hello, I am wondering why the Zip (and thus Jar) tasks include all of the
> parent
> directories for each file?  It seems that the file would just need its full
> path,
> and not a separate zip entry for the directory itself.  This would make
> viewing
> the archives much easier and possibly even reduce their size.

I like that behaviour and need it or else I end up creating
files in directories that's sole purpose is to ensure that
dir gets created. I have done this a lot with OS level zip
utilities and it suxs :<.

An optional attribute that turned of this behaviour would be
okay thou :P

Cheers,

Pete

*--------------------------------------------------*
| Latrobe University,     | Does the name 'Pavlov' |
| Bundoora, Australia     |    ring a bell ?       |
*--------------------------------------------------*