views:

735

answers:

2

So I'm using Ant with FDT 3 and I have Ant creating a jsfl to compile fla's. When I use the built in ${basedir} property in Ant it gives me the path with backslashes(\) in it because I'm on windows. The problem is that when its run through jsfl the slashes are taken as escapes. I need to know how to modify the basedir property so the slashes are forward slashes. I've tried splitting the basedir on backslashes in jsfl and joining it with forward slashes as a delimiter but the backslashes still cause problems.

So what I need to know is how to change the basedir in Ant to have forward slashes from within Ant which could be anything such as tricking it into thinking it needs to have a mac path or something along those lines.

Thanks

+2  A: 

You should be able to do it using the ant pathconvert task.

Here's a rough example:

<path id="basedir.path">
    <pathelement path="${basedir}" />
</path>
<pathconvert targetos="unix" property="basedir.unix" refid="basedir.path"/>
<echo message="${basedir.unix}" />

Then you can use ${basedir.unix} in place of ${basedir}

martin clayton
Thanks Martin that worked great!
Jordan
+1 Thanks, this was exactly what I needed too :)
StevenWilkins
You could also write the path conversion above as<pathconvert targetos="unix" property="basedir.unix"> <path location="${basedir}"/></pathconvert>
wrumsby
A: 

thks a lot, exactly what I needed. Clean for a "rough" example :o)

jcl