jay*_*jay 3 ant build-automation build-script
在我的构建文件中,我有一个ant目标,其中我有以下代码段,
<replaceregexp replace="custom.dir=${basedir}/tasks/custom" byline="true" file="${basedir}/MyApp/configuration.properties">
<regexp pattern="custom.dir=(.*)"/>
</replaceregexp>
Run Code Online (Sandbox Code Playgroud)
我想用"configuration.properties"文件中的路径替换"custom.dir"属性,但是一旦我执行了我的目标,我就会将"custom.dir"属性的条目修改为
custom.dir = C:arenaplaygroundmytestapp /任务/自定义
代替
custom.dir = C:\竞技场\操场\ mytestapp /任务/自定义
如何使用正确的文件分隔符将路径正确写入"configuration.properties"文件.我在窗户和蚂蚁使用的是蚂蚁1.8.
当您尝试将WINDOW_STYLE_PATH写入文件时,WINDOW_FILE_SEPARATOR被识别为转义序列字符.因此,您可以在将其写入文件之前更改unix样式的路径.Pathconvert将帮助您转换路径...
<pathconvert property="new" dirsep="/">
<path location="${basedir}"/>
</pathconvert>
<echo message="${new}"/>
<replaceregexp replace="custom.dir=${new}/tasks/custom" byline="true" file="${basedir}/configuration.properties">
<regexp pattern="custom.dir=(.*)"/>
</replaceregexp>
Run Code Online (Sandbox Code Playgroud)