KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I want to overwrite the hosts file on the Windows machine if the user allows it: <input message="Do you want to overwrite the HOSTS file?" addproperty="overwrite.hosts" validargs="yes,no" /> <copy tofile="${env.WINDIR}/system32/drivers/etc/hosts.backup"> <fileset file="${env.WINDIR}/system32/drivers/etc/hosts" /> </copy> <copy todir="${env.WINDIR}/system32/drivers/etc"> <fileset file="${trainer.dir}/hosts" /> </copy> How do I do the copies only if the user says yes? EDIT: I tried this: <input message="Do you want to overwrite the HOSTS file?" addproperty="overwrite.hosts" validargs="yes,no" /> <if> <equals arg1="${overwrite.hosts}" arg2="yes" /> <then> <copy tofile="${env.windir}/system32/drivers/etc/hosts.backup"> <fileset file="${env.windir}/system32/drivers/etc/hosts"> </fileset> </copy> <copy todir="${env.windir}/system32/drivers/etc"> <fileset file="${trainer.dir}/hosts"> </fileset> </copy> </then> </if> and I get this output: C:\trainer\build.xml:16: Problem: failed to create task or type if Cause: The name is undefined. Action: Check the spelling. Action: Check that any custom tasks/types have been declared. Action: Check that any <presetdef>/<macrodef> declarations have taken place. I'm an ant rookie... What do I need to do?
Tags (comma-separated)
Save Edits
Cancel