I’m creating an installer using Ant and I’m facing a problem. I need to create a file with different extension depending on the platform (Unix or Windows) but I don’t know how to get the current platform from Ant.
Can anyone help me? Thank you in advance,
Joshua.
Is this something you’re attempting to do in a
build.xml? The<condition>task supports the conditionoswhich can help you determine the platform for your install script:Then you can split tasks into Unix and Windows:
The
deploytarget will call bothdeploy.unixanddeploy.windows. However, thedeploy.unixtarget will be skipped if it’s a Windows system anddeploy.windowswill be skipped if it’s not a Windows system.And, if you’re using the
<exec>task, you can also specify if you’re running Windows or Unix: