BON
BON

Reputation: 443

Ant modifying property file but escaping characters

I have an ant build script that is modifying a properties file. When it amends the properties with the new paths, it seems to escape the back slashes and colons. I understand this is probably working as intended but batch files use this property file further down the process and it is causing errors.

Is there an ant solution to this, or should I start looking at a shell script workaround?

Thanks, BON

Ant target:

    <target name="modify_workstation_properties" depends="loadWinEnvVars, loadUnixEnvVars">
    <propertyfile file="${basedir}/Deliverables/config/framework_setup/workstation.properties">
        <entry key="toplevel.project.dir" value="${basedir}"/>
        <entry key="root.project.dir" value="${basedir}/Construction"/>
        <entry key="root.dir" value="${basedir}/Framework/Construction/netc_os"/>
        <entry key="jdk.home" value="${JDKHome}"/>
        <entry key="wls.home" value="${WLSHome}"/>
        <entry key="domain.dir" value="${DomainDir}"/>
        <entry key="stage.dir" value="${DomainDir}"/>
    </propertyfile>
</target>

Output:

# Top Level Root directory of the new working project
toplevel.project.dir=C\:\\forImage\\r16_dev_deploy

# Root directory of the new working project
root.project.dir=C\:\\forImage\\r16_dev_deploy/Construction

# Root directory of the framework project
root.dir=C\:\\forImage\\r16_dev_deploy/Framework/Construction/netc_os
...

Upvotes: 4

Views: 2455

Answers (1)

FailedDev
FailedDev

Reputation: 26940

No you can't modify the way that the properties are written. However after the file is written you could use the ReplaceRegExp task and correct the escaped characters.

Upvotes: 4

Related Questions