ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Re: tar task: how to include empty dirs
Date Thu, 07 Dec 2000 12:21:24 GMT
Anthony Goubard <anthony@tryllian.com> wrote:

> Stefan Bodewig wrote:
>> 
>> Wim Bervoets <wim.bervoets@iconmedialab.com> wrote:
>> 
>> > The Tar task doesn't seem to tar empty directories. How can I
>> > tell it to do that?
>> 
>> You are right, it doesn't. If you look into the generated tar files
>> you'll notice that it doesn't store any directories at all. Two
>> options: (1) modify Tar.java to store directories as well, (2) use
>> <exec> or <execon> and command line tar.
>> 
>> If you chose option (1), a patch to ant-dev would be much
>> appreciated 8-)
> 
> If you patch the tar file, can you do the same thing for the
> zip.java that also doesn't include empty directories.
> 

Not entirely true, as long as you include at least one file somewhere,
<zip> will include empty dirs as well, i.e.

    <delete dir="should.be.empty" />
    <mkdir dir="should.be.empty/testdir" />
    <touch file="should.be.empty/testfile" />
    <zip zipfile="empty.zip" basedir="should.be.empty" />

will work and include both testdir and testfile, while it won't do
anything if you remove the <touch> task. Speaking of Ant 1.2 that is
as I fixed Zip in CVS seconds ago 8-).

Stefan

Mime
View raw message