ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Glenn McAllister" <gle...@ca.ibm.com>
Subject RE: Nasty gotcha with new <delete>
Date Mon, 16 Oct 2000 22:00:27 GMT


The difference is that the old delete was using an implicit <fileset>
element, while the new one assumes that if you _don't_ specify any fileset
attributes, you want to delete the entire directory.  This was done to
replace the current <deltree> task.  Using the implicit <fileset> of delete
is now deprecated.

To get the effect you want, try

<delete>
  <fileset dir="${javaSourceDir}" />
</delete>

or (the deprecated way)

<delete dir="${javaSourceDir}" includes="**" />

Glenn McAllister
Software Developer. IBM Toronto Lab, (416) 448-3805
"An approximate answer to the right question is better than the
right answer to the wrong question." - John W. Tukey


Please respond to ant-dev@jakarta.apache.org

To:   "'ant-dev@jakarta.apache.org'" <ant-dev@jakarta.apache.org>
cc:
Subject:  RE: Nasty gotcha with new <delete>

I have to ask about this one- it appears that this will now delete the
directory itself, not just empty it out. Is that correct behavior?

I used to have this:

     <target name="EmptyDirs" depends="init">

        <echo message="Emptying: '${javaSourceDir}'" />
        <delete dir="${javaSourceDir}" />

        <echo message="Emptying: '${classesTargetDir}'" />
        <delete dir="${classesTargetDir}" />
    </target>

I don't recall it removing the directories, I thought it would just empty
them...

Please advice,
-Rz



> -----Original Message-----
> From: Glenn McAllister [mailto:glennm@ca.ibm.com]
> Sent: Friday, October 13, 2000 10:11 AM
> To: ant-dev@jakarta.apache.org; corey@kelman.com
> Subject: RE: Nasty gotcha with new <delete>
>
>
>
>
> The rational behind using separate dir and file attributes is
> to make what
> you are trying to delete explicit.  Admitedly, the number of
> times you are
> likely to delete a directory instead of a file are limited,
> however it can
> happen.  Also, we were trying to keep things consistent with
> the <copy> and
> <move> tasks, where the possible abiguity of whether
> something is a file or
> directory is unacceptable.
>
> Glenn McAllister
> Software Developer. IBM Toronto Lab, (416) 448-3805
> "An approximate answer to the right question is better than the
> right answer to the wrong question." - John W. Tukey
>
>
> Please respond to ant-dev@jakarta.apache.org; Please respond to
>       "corey@kelman.com" <corey@kelman.com>
>
> To:   "'ant-dev@jakarta.apache.org'" <ant-dev@jakarta.apache.org>
> cc:
> Subject:  RE: Nasty gotcha with new <delete>
>
> On Thursday, October 12, 2000 8:49 AM, Glenn McAllister
> [SMTP:glennm@ca.ibm.com] wrote:
> > I'll update the docs to make that more explicit.  Sorry if
> this caused
> you
> > any headaches.
> >
> > Hmm... would it make more sense to limit a delete to either a dir, a
> file,
> > or filesets?  That would make
> >
> > <delete dir="${some.dir}" file="somefile.txt" />
> >
> > illegal and prevent people from possibly blowing things away.
> >
> <snip>
>
> It might be more clear if there was simply one attribute for
> the delete tag
> specifying all objects to be deleted:
>
>  <delete filespec="${some.dir} ${some.file}" />
>
> That way there would be no confusion.  I don't see any need to specify
> directories & files to be deleted separately.  Maybe I'm
> missing something
> here?
>
> Regards,
> Corey
>
>
>
>




Mime
View raw message