ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Glenn McAllister <>
Subject [Fwd: Bug with <delete includeEmptyDirs> ?]
Date Wed, 07 Mar 2001 21:31:23 GMT
Actually move the discussion over this time... :-)

Glenn McAllister wrote:

> Moving this discussion over from ant-user.  Involves the bug that
> <delete includeEmptyDirs="yes"> ... </delete> only deletes empty leaf
> directories, and none of the intermediate dirs.
> --
> KC Baltz wrote:
> > Great, because this is a feature we could really use.
> I finally got a chance to look at the code.  It seems that my testcase
> was too simple - the directory structure wasn't deep enough.
> Here's a description of the problem.  I have the following directory
> structure:
> a/
>     b/
>         c/
>             d
>     e
> Lets say I have files in a and a/b/c.  So, when I do this:
> <delete includeEmptyDirs="yes">
>   <fileset dir="a" />
> </delete>
> which effectively says "Start at directory a, delete all files (ignoring
> those matching the default exclude patterns), and then delete all empty
> subdirectories."  What actually happens is "Start at directory a, delete
> all files, and then delete empty leaf directories."  So when we are
> done, the structure looks like
> a/
>     b/
>         c
> When I'm chosing what directories to delete, I'm using the
> DirectoryScanner.getIncludedDirs method.  The assumption is that since
> we are using a fileset, we should only try to delete matching empty
> directories.  The funny thing is, if the match pattern is "**" (which
> seems to be a pretty common case), only leaf directories are returned as
> a match.  Now, I've had this discussion before with other committers and
> been told that, in the general case, if the directory does not match the
> pattern it shouldn't be included.  Well, if thats the case, why wouldn't
> it match all the subdirectories with a "**" include pattern?  Why does
> it only match the leaf directories?
> Unless I hear otherwise (i.e., get -1'ed) I'm going to see about either
> changing DirectoryScanner to properly collect ALL directories and return
> them with getIncludedDirs, or create a new method getAllIncludedDirs to
> return all of them.  My preference is the former, but it may break some
> existing behaviour.  Any opinions?
> Glenn McAllister
View raw message