You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Matt Benson <gu...@yahoo.com> on 2005/03/07 21:39:55 UTC

empty string as pattern

When defining a file/dirset, if I want to exclude the
basedir itself I have to use includes="*/**" or some
similar trick.  I tried specifying a nested <exclude
name="" /> but that didn't work.  After digging into
PatternSet's code I see that we discard zero-length
patterns.  Does anyone know the historical reason
behind this?

Thanks,
Matt


	
		
__________________________________ 
Celebrate Yahoo!'s 10th Birthday! 
Yahoo! Netrospective: 100 Moments of the Web 
http://birthday.yahoo.com/netrospective/

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


Re: empty string as pattern

Posted by Stefan Bodewig <bo...@apache.org>.
On Mon, 7 Mar 2005, Matt Benson <gu...@yahoo.com> wrote:

> When defining a file/dirset, if I want to exclude the
> basedir itself I have to use includes="*/**" or some
> similar trick.  I tried specifying a nested <exclude
> name="" /> but that didn't work.

Yes, I ran into the same trap when I modified <sync> which made me
create and use DirectoryScanner#appendExcludes instead of simply
adding another PatternSet to the FileSet in the syncTarget != null
case.

> After digging into PatternSet's code I see that we discard
> zero-length patterns.  Does anyone know the historical reason behind
> this?

It has always been that way
<http://cvs.apache.org/viewcvs.cgi/ant/src/main/org/apache/tools/ant/taskdefs/MatchingTask.java?rev=1.1&view=markup>
and this code predates my involvement with Ant.

I have no idea why Stefano chose to code it that way.  Maybe, just
maybe this has been for cases like includes="foo  bar" (note two
spaces) and has been applied to the nested elements by accident.

When I coded PatternSet I merely moved the code from MatchingTask to
the new class.

Stefan

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