You can also look at the <if> task (part of the
ant-contrib project in SourceForge) which along with
the standard condition tasks will allow you to do the
following

   <if>
      <not>
         <isset property="some.thing">
      </not>
      <then>
         <things to do when some.thing is not set>
      </then>
      <else>
         <optional else block.../>
      </else>
    </if>
--- Douglas Kramer <[EMAIL PROTECTED]> wrote:

> Found "unless" attribute of target.
> 
> This simpler version works if ${MYFILE} resource is
> a file or directory,
> but fails if a symlink (which is what I devised this
> for).
> 
>     <target name="test">
>         <available file="${MYFILE}"
> property="file.exists" value="true" />
>     </target>
> 
>     <target name="dosomething" depends="test"
> unless="file.exists">
>         <echo message="Do something here">
>     </target>
> 
> Am bummed out.
> 
> -Doug
> 
> Douglas Kramer wrote:
> > Okay, try again.
> > 
> > Need to create a file (actually a symlink) if none
> exists.
> > 
> > Is there a way to set a property true if a
> resource does *not* exist?
> > 
> > 
> > DETAIL
> --------------------------------------------
> > 
> > The dosomething task will do something only if the
> file
> > exists.
> > 
> >   <target name="test">
> >       <available file="${MYFILE}"
> property="file.exists" value="true" />
> >   </target>
> > 
> > 
> >   <target name="dosomething" depends="test"
> if="file.exists">
> >       <echo message="Do something here">
> >   </target>
> > 
> > I tried using <not>, but it won't work, because
> the "not"
> > operation of "is not set" is not true.
> > 
> >   <target name="test">
> >       <condition property="file.notexists">
> >          <not>
> >              <available file="${MYFILE}"
> property="file.exists" 
> > value="true" />
> >          </not>
> >       </condition>
> >   </target>
> > 
> > Ideas?  I don't see a NotAvailable task.
> > 
> > -Doug
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> > For additional commands, e-mail:
> [EMAIL PROTECTED]
> > 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to