I would use the <mkdir> task to create the directory. I would also consider deleting the directory before the mkdir. Is there a need for the multi-line <condition>? Ant is not intended to be a scripting language.
On Fri, Dec 26, 2008 at 6:21 PM, Anna Teittinen <ateitti...@i-a-i.com>wrote: > Hello, > > I am relatively new to using ant. > Can somebody help me with a problem I have in my build.xml file? > Below is a snippet of code from my build.xml file. > Below, "caratsharp.dir" refers to a directory. > Basically, if that directory exists, then the clean, prepare, jar, and > copy_jar targets will get called; otherwise, an error msg should be printed > and nothing more happens. > > When this build.xml is called when the "caratsharp.dir" directory exists, > all the antcall commands get done... great! > However, when I run this script when the "caratsharp.dir" directory does > not exist, the error msg does not get printed. > > Does anyone have any insight to why the error msg ("${caratsharp.dir} does > not exist") does not get printed? > > > <target name="checkForCaratSharpDir"> > <available property="present" file="${caratsharp.dir}" /> > <available property="isaDir" file="${caratsharp.dir}" type="dir" /> > <condition property="isaDir"> > <and> > <isset property="present" /> > <not> > <isset property="isaFile" /> > </not> > </and> > </condition> > </target> > <target name="exists" depends="checkForCaratSharpDir" if="present"> > <echo message="${caratsharp.dir} exists" /> > <antcall target="clean" /> > <antcall target="prepare" /> > <antcall target="jar" /> > <antcall target="copy_jar" /> > </target> > <target name="printError" depends="checkForCaratSharpDir" if="isaFile"> > <echo message="${caratsharp.dir} does not exist" /> > </target> > <target name="all" depends="exists,printError" description="Cleans, > compile then builds the JAR file." /> > > > > Thanks so much in advance for your help, > --Anna > > __________________________________________________________________________ > This message and all attachments are PRIVATE, and contain information that > is PROPRIETARY to Intelligent Automation, Inc. You are not authorized to > transmit or otherwise disclose this message or any attachments to any > third party whatsoever without the express written consent of Intelligent > Automation, Inc. If you received this message in error or you are not > willing to view this message or any attachments on a confidential basis, > please immediately delete this email and any attachments and notify > Intelligent Automation, Inc. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@ant.apache.org > For additional commands, e-mail: user-h...@ant.apache.org > >