मैं मेजबान अधिलेखित करना चाहते हैं Windows मशीन पर फ़ाइल उपयोगकर्ता की अनुमति देता है अगर यह:चींटी: सशर्त कॉपी
<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>
मैं प्रतियां करना कैसे करते उपयोगकर्ता कहते हैं केवल यदि हाँ?
संपादित करें:
मैं इस कोशिश की:
<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>
और मैं इस उत्पादन प्राप्त करें:
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.
मैं एक चींटी रूकी हूँ ... मुझे क्या करना चाहिए?
मुझे एक और लक्ष्य बनाना है। यह हर सशर्त काम के लिए है, मुझे इसका परीक्षण करना है, फिर संपत्ति सेट करें और नया लक्ष्य बनाएं जो सेट संपत्ति पर कॉल किया जाएगा? कोई अन्य तरीका ? –
हां, बिल्कुल, यदि आप अलग-अलग स्थानों से अलग-अलग फाइलों का एक समूह कॉपी करते हैं और आप केवल कुछ फाइलों की प्रतिलिपि बनाना चाहते हैं, लेकिन दूसरों को नहीं ... आपको कार्यों के एक ही सेट के साथ अनावश्यक लक्ष्य की आवश्यकता है, यह तय करने के लिए लक्ष्य के अंदर शर्त बनाम कॉल करने के लिए या नहीं – sloven