Handle file:// protocol in Ant script
Question
Some Ant targets require an URL to be defined as property (like the ivy pattern
) and since the file://
protocol is different on Windows (either file:/
or file:///
) and Unix (file://
) it makes the entire script less portable.
Is there a nice way to handle the file
protocol without messing around with properties and Ant conditions?
Solution 2
I finally decided to use the Condition task of Ant:
<condition property="file.protocol" value="file:///" else="file://">
<os family="dos"/>
</condition>
OTHER TIPS
Using file:///
should work on both systems. But perhaps the PathConvert task can help you out here?
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow