You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Regis Melo <re...@softsite.com.br> on 2003/05/06 18:39:12 UTC

Help!!! How to verify if archive has some content

Hello!

	I want to verify if my archive contains some content. Something like this:

	if( ! myFileContains("myToken" ) )
		buildFail();

	
	There is any way to do this using ANT??

Thanks,

Regis Melo




Re: Help!!! How to verify if archive has some content

Posted by peter reilly <pe...@corvil.com>.
You can use the combination of <loadfile/> and 
<condition><contains/></condition>
as in:
  <target name="contains">
    <loadfile property="file.contents" srcfile="file.txt"/>
    <condition property="file_has_seach_string">
      <contains string="${file.contents}" substring="${search.string}"/>
    </condition>
    <echo message="has string: ${file_has_seach_string}"/>
  </target>

Peter

On Tuesday 06 May 2003 17:39, Regis Melo wrote:
> Hello!
>
> 	I want to verify if my archive contains some content. Something like this:
>
> 	if( ! myFileContains("myToken" ) )
> 		buildFail();
>
>
> 	There is any way to do this using ANT??
>
> Thanks,
>
> Regis Melo
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org


Re: Help!!! How to verify if archive has some content

Posted by Jesse Stockall <st...@magma.ca>.
On Tue, 2003-05-06 at 12:39, Regis Melo wrote:
> Hello!
> 
> 	I want to verify if my archive contains some content. Something like this:
> 
> 	if( ! myFileContains("myToken" ) )
> 		buildFail();
> 
> 	
> 	There is any way to do this using ANT??
> 

Have a look at the <available> task
http://ant.apache.org/manual/CoreTasks/available.html

-- 
Jesse Stockall <st...@magma.ca>