ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <DDevie...@lgc.com>
Subject RE: Re[2]: reverse glob mapper pattern?
Date Mon, 23 Sep 2002 20:29:15 GMT
I agree it's bad, but it's even worse, since as Stefan pointed out,
'includes' is comma *and* space separated, so the current approach can
potentially fail if the relative pathname (stripped of its prefix by
<pathconvert>) contains any spaces in it!!!

I'm still surprised the selectors cannot select the files Jacob wants to
delete, but instead of going all this way around (with a flawed method at
that), the easiest thing would be for Jacob to write his own selector.

Something like (not tested):

public class IsSampleCopySelector extends BaseSelector {
  ...
  public boolean isSelected(File basedir, String filename, File file) {
    File parent = file.getParent();
    String name = file.getName();
    File sampleFile = new File(parent, "sample."+name);
    return sampleFile.exists() && sampleFile.isFile();
  }

}

As far as campaigning for my weekend hacking to add a nested <condition> to
all Task-deriving tasks: I'm not planning on wasting my breath on a lost
cause... --DD

-----Original Message-----
From: Diane Holt [mailto:holtdl@yahoo.com] 
Sent: Monday, September 23, 2002 2:59 PM
To: Ant Users List; Jacob Kjome
Subject: Re: Re[2]: reverse glob mapper pattern?

--- Jacob Kjome <hoju@visi.com> wrote:
> However, now I have a problem that if this is run and
> no * files exist, the "includes" attribute on the filesets inside
> <delete> ends up being empty like includes="".  When that happens, the
> fileset selects *all* files as part of the fileset so the entire
> project is deleted except for the default excludes.  That is extremely
> bad!

You'll need to break out the <delete> into a separate target, have it
depend on the <fileset>'ing/<pathconvert>'ing target, then 'if' on the
property that you'd be passing to 'includes' so that the target that does
the delete only runs if the property gets set. Of course, if all tasks
supported if/unless, you could just add an 'if' to the <delete> --
unfortunately that's not available just yet (hint,hint to DD to campaign
for his patch :)
 
Diane

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


Mime
View raw message