ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian DeWeese <brd1_reut...@yahoo.com>
Subject Re: Getting the filename from a property
Date Thu, 28 Feb 2002 16:17:19 GMT
This requires that I separate the property in 2 parts, the path and
the filename, so then since I already have the filename by itself
there's no need to parse it.

I need this for a <ant> call so I think the best solution is to
separate the property out as you suggestion and pass both parts into
the ant call.  The fully qualified name is needed for a <copy> task
where the lonesome filename is needed for the Netscape signing tool.

This will solve my problem in the short run, but I still think it
would be nice to have a special property syntax to extract the parts.
 Erik's suggestions are probably better than mine, but FWIW I was
thinking about something like $f{property} where each letter between
the $ and { stood for a part; f=filename, e=extension, p=path, and so
on.  But that's not very readable.

Brian

--- Diane Holt <holtdl@yahoo.com> wrote:
> --- Brian DeWeese <brd1_reuters@yahoo.com> wrote:
> > What would be the best way to get just the filename from a
> property
> > whose value is a fully qualified path?
> > 
> > Such as get "foo.txt" from "d:\dir1\dir2\foo.txt".
> 
>  <property name="foodir" location="d:/dir1/dir2"/>
>  <target name="doFilename">
>     <pathconvert pathsep="${file.separator}" property="filename">
>       <path>
>         <pathelement location="${foodir}/foo.txt"/>
>       </path>
>       <map from="${foodir}${file.separator}" to=""/>
>     </pathconvert>
>     <echo message="filename = ${filename}"/>
>  </target>
> 
> Diane
> 
> 
> 
> =====
> (holtdl@yahoo.com)
> 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Greetings - Send FREE e-cards for every occasion!
> http://greetings.yahoo.com
> 
> --
> To unsubscribe, e-mail:  
> <mailto:ant-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:ant-user-help@jakarta.apache.org>
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Greetings - Send FREE e-cards for every occasion!
http://greetings.yahoo.com

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


Mime
View raw message