ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Loughran <ste...@apache.org>
Subject Re: Location attribute in property not resolving correctly
Date Thu, 05 Oct 2006 09:26:25 GMT
Rebhan, Gilbert wrote:
> Hi,
> 
> still no solution ?
> Should i fill a bug report about that behaviour
> of <propertyfile file="... " />
> 
> resulting in a deformed path, f.e.
> 
> Y:/bla/corba.jar >>> Y\:/bla/corba.jar
> 
> ?!
> 
> see example below
> 
> same result with ant 1.7.0 beta2
> 
> 
> Regards, Gilbert
> 
> -----Original Message-----
> From: Rebhan, Gilbert [mailto:Gilbert.Rebhan@huk-coburg.de] 
> Sent: Wednesday, September 27, 2006 8:03 AM
> To: Ant Users List
> Subject: RE: Location attribute in property not resolving correctly
> 
>  
> Hi,
> 
> strange =
> 
> <project name="bla" default="main" basedir=".">
>     <!-- Import AntContrib -->
>     <taskdef resource="net/sf/antcontrib/antlib.xml" />
>     <target name="depends">
>         <timestampselector 
>             outputsetid="mypath"
>             count="1"
>             age="eldest" >
>         <path>
>             <fileset dir="Y:/bla">
>                 <include name="*.jar" />
>             </fileset>
>         </path>
>         </timestampselector>
>         <pathconvert refid="mypath" property="myfixedpath"
> targetos="unix"/>
>         <echo>myfixedpath === ${myfixedpath}</echo>
> 
>         <echo
> file="Y:/bla/foobar1.properties">filepath=${myfixedpath}</echo>
>         <echo
> file="Y:/bla/foobar2.properties">filepath=${myfixedpath}</echo>
> 
>     </target>
> 
>     <target name="main" depends="depends">
>         <propertyfile file="Y:/bla/foobar1.properties" />
>         <echo>Targetfile === ${filepath}</echo>
>     </target>
> </project>
> 


> foobar1.properties, the file which is loaded in the main target looks
> like =
> #Wed Sep 27 07:53:37 CEST 2006
> filepath=Y\:/bla/corba.jar
> 
> foobar2.properties looks like =
> filepath=Y:/bla/corba.jar


> so it seems like the timestamp gets added when loading the propertyfile
> with <propertyfile file="..."> but what is really fishy is that the path
> goes bad
> 
> from : Y:/bla/corba.jar to: Y\:/bla/corba.jar

1. Timestamps go in when the file is created,  using <propertyfile>, 
which delegates to Properties.store()
2. It is correct to escape the : with a \ , as this is what 
Properties.store() does.

 
http://java.sun.com/j2se/1.4.2/docs/api/java/util/Properties.html#load(java.io.InputStream)


> 
> What's responsible for that ?

Sun

> and
> how to make the example above working ?

I dont wee why escaping the \: should matter, as when the properties get 
loaded in the escape should be removed and you get what you originally 
asked for.

-steve

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


Mime
View raw message