ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Leonhardt" <leonha...@informatik.tu-darmstadt.de>
Subject AW: Available task
Date Fri, 24 Aug 2001 16:48:07 GMT
Ok,

>
> > Hi, as I understand it the available task is only able to work with
> > pathsets if it's looking for a class. If it's looking for a file
> > it's looking for the absolut value.
>
> But can look it up in a path that you refer to by the filepath
> attribute in Ant 1.4.  This patch has been in CVS since more than a
> months, but it is still undocumented, I'm going to change that.
>

I'm using a filepath attribute now, as follows. The problem is that what
I think the availible task should do is not what it's doing.
I want to search a given directory -- specified with a pattern --
for a file.

  <target name="check_for_data_files">
    <available property="lexer.dat.present"
               file="lexer.dat" >
      <filepath>
          <fileset dir="${build.classes}" >
            <include name="**/java2/lexer/*"/>
          </fileset >
      </filepath >
    </available >
  </target >

If I do the above thing the available task gets a set of matching files
which I want to check for the file lexer.dat.
The problem now is the method checkFile(). It treats the filepath as a set
of
paths (maybe thats where the name comes from ;O)). Because of this
the following code is used to check if the right file was found.

if(new File(paths[i], file.getName()).isFile()) {
                   return true;
}

But If this method gets a set of files it does the wrong thing. The above
code
checks if the file ../../somedir/wantedFile.ext/wantedFile.ext exists
instead of
simply checking if ../../somedir/wantedFile.ext is the file we won't.

I admit the because of the name of the attribute I'm doing the wrong thing
by
specifing a set of files. But as it's allowed by the filepath shouldn't it
work then?

Thomas


Mime
View raw message