ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diane Holt <hol...@yahoo.com>
Subject Re: Must specify a file not a directory in the filtersfile attribute
Date Fri, 28 Jun 2002 20:55:30 GMT
--- Olivier Gourment <ogourment@yahoo.com> wrote:
> I want to use a filter file ONLY if it exists. The name of this filter
> file includes a variable part with a ${property}. When I do that and
> the filtersfile does not exist, I get the following error:
> 
> Must specify a file not a directory in the filtersfile
> attribute:filters01.properties

The fact that part of the file name is a specified via a property doesn't
matter -- just the fact that the file doesn't exist does.

> First, the error message is a little misleading.

I'd say not only misleading, but a bug, since it should say something
about the file not being found, not tell you've specified a directory when
clearly you haven't. Want to supply a patch?

> Second, is there a way to make this work, apart from creating an
> empty file named filters01.properties?

If you can live with Ant barking at you about overriding a reference, yes:

  <filterset id="fls01"/>

  <target name="init.filters01" if="filters01.available"
          depends="chkFilters01">
    <filterset id="fls01">
      <filtersfile file="filters01.properties"/>
    </filterset>
  </target>

  <target name="chkFilters01">
    <available file="filters01.properties" type="file"
               property="filters01.available"/>
  </target>

  <target name="doCopy" depends="init.filters01">
    <copy file="orig.txt" tofile="copied.txt" filtering="on">
      <filterset refid="fls01"/>
    </copy>
  </target>

Diane

=====
(holtdl@yahoo.com)



__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message