I definitely agree that the task should log a message when you try to delete a file or directory that doesn't exist, but I don't think it should cause an exception.
 
The delete task should only fail when the file or directory that you specified can't be deleted.
 
I propose the following attributes (which, more of less, correspond with the attributes/properties of the Ant version of the Delete task) :
 
file The file to delete, specified as either the simple filename (if the file exists in the current base directory), a relative-path filename, or a full-path filename. At least one of the two, unless a <fileset> is specified.
dir The directory to delete, including all its files and subdirectories.
verbose Show the name of each deleted file ("true"/"false"). Default is "false". No
quiet If the specified file or directory does not exist, do not display a diagnostic message or modify the exit status to reflect an error. When set to "true", if a file or directory cannot be deleted, no error is reported. Default is "false". Setting this to "true" implies setting failonerror to "false". No
failonerror Controls whether an error (such as a failure to delete a file) stops the build or is merely reported to the screen. Only relevant if quiet is "false". Default is "true". No
includeEmptyDirs Set to "true" to delete empty directories when using filesets. Default is "false". No
 
As you can see, the proposed behaviour will, by default, display a diagnotistic message when you try to delete a file or directory that doesn't exist.
 
I everyone agrees, I'll try to post a patch for this tomorrow.
 
Gert
 
 
 
----- Original Message -----
Sent: Wednesday, February 19, 2003 8:07 PM
Subject: Re: [nant-dev] Delete task behaviour

>
> Gert:
>
> >If something that you specify doesn't even exist, the delete task should
> >consider it tasks done.
>
> Then change my property idea to allow a warning to be emitted. (say verbose
> ="true" or warn_if_missing="true") While I agree the task will be happy
> that directory is not there, Gerry has a valid point that this could be the
> source of a frustrating and hard to find bug in your script.
>
> Best,
> Bill
>
> William E. Caputo
> ThoughtWorks, Inc.
> --------
> It is impossible to design a system so perfect that no one needs to be
> good. -- T.S. Eliot
>
>
>
>
>                                                                                                                                       
>                       "Gert Driesen"                                                                                                  
>                       <
gert.driesen@pan        To:       <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]>                          
>                       dora.be>                 cc:       <
[EMAIL PROTECTED]>,                                     
>                                                 <
[EMAIL PROTECTED]>                                         
>                       02/19/2003 01:00         Subject:  Re: [nant-dev] Delete task behaviour                                         
>                       PM                                                                                                              
>                                                                                                                                       
>                                                                                                                                       
>
>
>
>
> We should put the logic where it belopngs, the delete task should only make
> sure that it's removed whatever you specify ...
>
> If something that you specify doesn't even exist, the delete task should
> consider it tasks done.
>
> Just my 2 cents.
>
> ----- Original Message -----
> From: <
[EMAIL PROTECTED]>
> To: <
[EMAIL PROTECTED]>
> Cc: "Gert Driesen" <
[EMAIL PROTECTED]>;
> <
[EMAIL PROTECTED]>;
> <
[EMAIL PROTECTED]>
> Sent: Wednesday, February 19, 2003 7:17 PM
> Subject: Re: [nant-dev] Delete task behaviour
>
>
> >
> > Gerry:
> > ><delete dir="f00"/>
> >
> > >The delete task will not raise an error and your directory foo will not
> > >exist.
> >
> > I liked the feature that Gert suggested, but I see Gerry's point. What
> > about this:
> >
> > Add an attribute, say "ignore_failures" (name open to suggestions!) that
> > toggles the behavior described:
> >
> > <delete ignore_failures="false" dir="f00" />
> >
> > Gert's scenario could be accomplished thusly:
> > <delete ignore_failures="true" dir="foo" />  <!-- if foo doesn't exist,
> we> will consider that a success -->
> >
> > IMO giving people the power to do what they want (with options that they
> > can ignore if they aren't ready for them) is a more useful approach than
> > simply having or not having a feature.
> >
> > Whichever scenario is the more common, would be the default (or the
> current
> > behavior could be the default)
> >
> > Does that address your concern Gerry?
> >
> > Best,
> > Bill
> >
> > William E. Caputo
> > ThoughtWorks, Inc.
> > --------
> > It is impossible to design a system so perfect that no one needs to be
> > good. -- T.S. Eliot
> >
> >
> >
> >
> >
>
>
>
>
>
>
>

Reply via email to