ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve Loughran" <stev...@iseran.com>
Subject Re: Two possible new tasks
Date Thu, 28 Feb 2002 08:24:03 GMT

----- Original Message -----
From: "Diane Holt" <holtdl@yahoo.com>
To: "Ant Developers List" <ant-dev@jakarta.apache.org>
Sent: Wednesday, February 27, 2002 11:07 PM
Subject: Two possible new tasks


> The question has come up on ant-user before, and again today, whether
> there's a way to get just the filename from a full-path property value.
> There are ways to do it, but they're all a bit roundabout (except the
> <script> way, which, despite Erik's feeling my <script>'s are "convoluted
> and wacky", is actually pretty straightforward, in that it's a single task
> to do the job). But <script> aside (which, since it requires extra libs
> and extra know-how, a lot of people seem to not want to get into using),
> it seemed like it could be something suited to a new task, so I've written
> a couple: <basename> and <dirname>. They're exceedingly simple, so I don't
> imagine including them would generate much new overhead, but I wanted to
> check before I put them through. Usage is:
>
> <basename property="..." file="..."/>
> <dirname property="..." dir="..."/>

+1 if you can come up with some good tests. I am not sure about basename.
does it mean the name of the file up to but not including the file itself,
or is it the file name without any directories.

I used to use a function _splitpath() in C, that would take a full path and
split it into all the horrible parts you got in dos: drive, dir, filename,
maybe extension, I forget.

something like that might be a good approach. Specify the parts of the path
you want and get it. course we cant call it splitpath because of the
confustion that'd cause

<splitfilename srcFile="somefile.xml" dirProperty="dir"
filenameProperty="filename" />

thoughts?#


-steve


--
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