ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From MichaelStgt <michael.stuttg...@gmx.de>
Subject converting slashes in attributes of script tasks in macrodefs
Date Wed, 05 Aug 2009 18:29:53 GMT

I have the following problem with ant 1.7.1 on windows
example where the first / of property2 ist first converted 
plattformspecifc to \ because ${basedir} is used and then dropped inside 
the javascript.
How can I avoid this, that i have the original value inside the script?

Output:
      [echo] demo1=c:/download/sub1
      [echo] demo2=c:\download/sub2
      [echo] demo1=c:/download/sub1
      [echo] demo2=c:download/sub2

Examplescript:

<project name="MyProject" default="demo" basedir="c:/download">
<target name="demo">
<property name="p1" value="c:/download/sub1"/>
<property name="p2" value="${basedir}/sub2"/>
<testatt demo1="${p1}" demo2="${p2}"/>
</target>

     <macrodef name="testatt">
         <attribute name="demo1" default="default" />
         <attribute name="demo2" default="default" />    	
         <sequential>
         	<echo>demo1=@{demo1}</echo>
         	<echo>demo2=@{demo2}</echo>
         	<script language="javascript">
         		<![CDATA[
         		a1="@{demo1}";
         		a2="@{demo2}";
         	    echo = project.createTask("echo");
     	        echo.setMessage("demo1="+a1);
     	        echo.perform();
         		echo.setMessage("demo2="+a2);
         	    echo.perform();
         	    ]]> </script>

         </sequential>
     </macrodef>


   </project>

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


Mime
View raw message