ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Ludwig <>
Subject Re: Doing Ant builds
Date Thu, 18 Jun 2009 22:45:49 GMT
Steve Loughran schrieb am 18.06.2009 um 16:54:11 (+0100):
> Michael Ludwig wrote:

> >Ant, however, goes one step further: It will remove a write-protected
> >file, which will not work using Windows tools without force, and it
> >will even recursively remove a write-protected directory. That's not
> >at all intuitive, and I think you could argue it could be quite
> >harmful.
> There's nothing complex going on in there, it just runs through every
> file in the list, starting at the bottom, and goes File.delete() on
> it; after deleting every file in a directory, it does the directory. I
> don't think its trying to be malicious.
> If you want ant to honour write-protect options, you could probably
> extend delete to do it with a new attribute. Add the relevant tests
> and we'll put it in.

A challenge :-) Okay ... It's just "private boolean delete(File f)" in
"", right?

I'd add some code to check for an additional attribute (I'm inclined to
check for @force = 'false'), map that to the member "private boolean
force = true" (force by default) and then check for "this.force ==
false" to call file.canWrite() before calling file.delete(), and on
hitting write-protection I'd return false.

And then some tests. Would that be all?

Michael Ludwig

> Author: Ant in Action 

PS: Wrong URL?

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message