ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erik Hatcher" <jakarta-...@ehatchersolutions.com>
Subject Re: Getting the filename from a property
Date Thu, 28 Feb 2002 02:40:39 GMT
Good grief!  :)

We gotta make things like this simpler, perhaps with special property syntax
similar to how MessageFormat stuff works.

${propertyname,file,filename}

Come to think of it, is MessageFormat at all extensible to be able to define
other things besides "date", "time", "number", or "choice"? [I don't think
so, but one can dream!]

Is something like this at all on the table for Ant2?  Since we can break all
the 1.x rules, I'd like to put something like this on the Ant2 drawing
board. It'd be a shame to totally screw up property syntax, and I'm not at
all sure I'm on the right track with the above syntax, but certainly commas
are not commonly used in property names now.

These "hacky" workarounds are just far too ugly and unnecessary.  We have to
make Ant speak more like the "domain" we're working in (that is, Java,
files, paths, resources, etc, etc).  Ant does a great job at this with its
datatypes, but we have a ways to go to avoid these kinds of situations.

Thoughts? Comments?

    Erik


----- Original Message -----
From: "Diane Holt" <holtdl@yahoo.com>
To: "Ant Users List" <ant-user@jakarta.apache.org>
Sent: Wednesday, February 27, 2002 7:25 PM
Subject: Re: Getting the filename from a property


> --- 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">
> [yaddayaddayadda...]
>
> Oh wait -- that would require you to know the leading path, and in which
> case, there wouldn't really be any need for you to go through any voodoo
> to find out the filename (doh!).  So I suspect you need some way to get
> the filename off a path you don't know, right?  In that case, I can only
> think of two ways: 1) <exec> 'basename', if you're all *nix all the time,
> or 2) otherwise, use <script> (I wrote one to do that, if you want it).
> Oh, I thought of a third, if you can use 1.5alpha -- <propertyfile> the
> property out to a file (using a new name for what will become the
> just-the-filename property), <replaceregexp> the value down to just the
> filename, then read the properties file in.
>
> 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>
>
>


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


Mime
View raw message