Hi all,

I want to check whether directory exists and branch by the result. Is it
possible in current NAnt?

I add some <if> attributes for now but maybe this could be solved in general
way. Maybe to set some ${result} property in tasks (as <mkdir> task in this
case). It could be possible check that property against some error codes or
so. When I first come to NAnt I was really shocked you couldn't check result
code of previous task. Except of failonerror="true" of course. This is
enough in most cases but sometimes you want to check for error and make some
other action.

How do you feel about it?

Martin


here is snip from my build file to see what I want to do:

     <copy todir="${build.dir}">
      <fileset basedir="${local.dir}">
       <includes name="**"/>
      </fileset>
     </copy>

     <foreach item="Folder" in="${source.dir}" property="foldername">
      <regex pattern="^(?'path'.*(\\|/)|(/|\\))(?'folder'.*)$"
input="${foldername}"/>
      <ifnot pathexists="${build.dir}\${folder}">
       <copy todir="${build.dir}" overwrite="false">
        <fileset basedir="${source.dir}">
         <includes name="${folder}\**"/>
        </fileset>
       </copy>
      </ifnot>
            </foreach>

Attachment: if.patch
Description: Binary data

Reply via email to