Hello Diane,
I've got things working with one more issue to solve. Stefan Bodewig pointed out that
if I set the
properties that have my directory locations using the "location"
attribute rather than "value", Ant will turn it into a nice absolute
path just like the fileset produces. Now the <map> works for me. So,
I currently have this:
<fileset dir="${src.dir}" id="src.sample.fs">
<present targetdir="${src.dir}">
<mapper type="glob" from="sample.*" to="*" />
</present>
</fileset>
<fileset dir="${build.dir}" id="build.sample.fs">
<present targetdir="${build.dir}">
<mapper type="glob" from="sample.*" to="*" />
</present>
</fileset>
<pathconvert pathsep="," property="src.sample.fs.copies" refid="src.sample.fs">
<map from="${src.dir}${file.separator}sample." to=""/>
</pathconvert>
<pathconvert pathsep="," property="build.sample.fs.copies"
refid="build.sample.fs">
<map from="${build.dir}${file.separator}sample." to=""/>
</pathconvert>
<echo message="${src.sample.fs.copies}"/>
<echo message="${build.sample.fs.copies}"/>
<delete>
<fileset dir="${src.dir}" includes="${src.sample.fs.copies}"/>
<fileset dir="${build.dir}" includes="${build.sample.fs.copies}"/>
</delete>
Now this works *if* there are * files that have an equivalent sample.*
also existing. 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! I tried fixing it by providing a "encludes" attribute like
excludes="**/**". However, now that overrides the "includes"
attribute and won't delete anything even if the "includes" attribute
actually list files to include.
Is there a way to say exclude everything except for a non-empty
"includes" attribute?
Jake
Monday, September 23, 2002, 1:33:09 PM, you wrote:
DH> --- Dominique Devienne <[EMAIL PROTECTED]> wrote:
>> You'll also see that the <present> selector selects the wrong files,
DH> No, it selects it says it does -- namely, it selects only those files that
DH> have an equivalent, as specified. It doesn't say it'll return *both* the
DH> files that have an equivalent *and* the equivalent file(s) as well.
DH> You could, theoretically, do it with two <fileset>'s (one to do an
DH> equivalent for sample.* -> *, and one to do it the other way around) --
DH> only when you're doing delete's, by the time you get to evaluating the
DH> second <fileset>, the equivalents have already been deleted, so the second
DH> <fileset> comes up empty, which is why you need to evaluate them
DH> beforehand, and get the files they return into a property, then pass the
DH> value of that property to <delete>. And of course, since <delete> won't
DH> take more than one file in the 'file' attribute, you need to pass the list
DH> to 'includes' instead, which is why you need to lop off the leading path
DH> up to the directory specified in 'dir', which is why you need to go
DH> through <pathconvert>.
DH> Diane
DH> =====
DH> ([EMAIL PROTECTED])
DH> __________________________________________________
DH> Do you Yahoo!?
DH> New DSL Internet Access from SBC & Yahoo!
DH> http://sbc.yahoo.com
DH> --
DH> To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
DH> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
--
Best regards,
Jacob mailto:[EMAIL PROTECTED]
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>