You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Martin Frydl <ma...@idoox.com> on 2000/11/28 18:10:37 UTC

Single file in FileSet

Hi,

    I have problem with specifying <srcfiles> to <uptodate> element when
I don't know base directory, only file to check. For example I have
property srcfile and use this:

      <uptodate property="isUptodate" targetfile="${targetfile}">
          <srcfiles dir="???" includes="${srcfile}"/>
      </uptodate>

I don't know how to create dir value if I know only srcfile - which may
be relative or absolute. I tried "." and "/" but "." can't work if file
is in upper directory and "/" can't work if file is relative to ".".
Because I haven't found how to do this, I created a simple patch to
org.apache.tools.ant.types.FileSet. Now it can be written as

    <srcfiles file="${srcfile}"/>

Patch is very simle, it just splits filename into directory and filename
parts and calls setDir and setIncludes. It was using Ant 1.2 sources.

(May be I missed something and it can be done in different way (without
this patch))

    Martin