Thanks, Diane, at least for confirming that I'm not crazy.
I am very sorry that I "discovered" <pathconvert> this morning. I wasted much too much time on it. I had already decided to roll my stuff back unless someone could come up with an obvious fix I was overlooking. As I think you surmised, my "sample" was just to demonstrate the flaw, not what I was REALLY trying to do. Here's what I'd LIKE to be able to do. We have a number of programs that are launched from batch files. These batch files do things like call other batch files and we have found that relative paths do not work and we've always hardcoded full paths. Then we got smarter and started using replaceable parameters and that worked pretty well. But it still always bothered me that that I have this one property which I call "dist.dir.bin" which is the directory into which ant dumps the modified binaries with the replaced parameters and another property "runtm.bin" which represents the directory from which it is run. Logically, these are the same directory or at worst, a root-to-root mapping, differing only in slash vs. backslash. <pathconvert> ought to be able to handle this, and it isn't. This means that every little change in build environment entails a tweaking period, especially when doing test builds for my own code changes. It's so annoying and unnecessary. And while we're at it, I can't tell since I've never gotten the pathconvert map to work right, but can the "from" and "to" parameters handle embedded property strings as well as literals? I may have a go at fixing this. ... Or else, we should really get smart and port this whole mess to unix :-) -----Original Message----- From: Diane Holt [mailto:[EMAIL PROTECTED]] Sent: Tue 2/19/2002 7:00 PM To: Ant Users List Cc: Subject: Re: pathconvert - why doesn't this work? --- Steve Cohen <[EMAIL PROTECTED]> wrote: > What am I doing wrong? (ant 1.5a built about a week ago) Nothing -- it's just that <pathconvert> is a little woobly. See: http://marc.theaimsgroup.com/?l=ant-user&m=100810074614382&w=2 You're trying to deal with a Unix-style pathname, but you're running on a Win* box, so by the time <path> has had at your "/build", it's already become "E:\build", so there's nothing to match in the mapping. What you need to do is to account for that weirdness: <project name="test" default="testtarget"> <property name="dist.dir" value="/build"/> <target name="testtarget"> <pathconvert pathsep=":" property="p1"> <path> <pathelement location="${dist.dir}"/> </path> <map from="E" to="C"/> </pathconvert> <echo message="mapped ${dist.dir} ==> ${p1}"/> </target> </project> Of course, that sucks, because then you've got that hard-coded "E" drive letter in there, and that's probably not guaranteed to always be the drive this is being run on, right? <pathconvert> should probably be re-thought, but in the meantime... Recommendation: Find another way to do what you need to do without using <pathconvert> :) Diane ===== ([EMAIL PROTECTED]) __________________________________________________ Do You Yahoo!? Yahoo! Sports - Coverage of the 2002 Olympic Games http://sports.yahoo.com -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
