----- Original Message -----
From: "Diane Holt" <[EMAIL PROTECTED]>
To: "Ant Developers List" <[EMAIL PROTECTED]>
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:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to