Hi Brian,

Thanks for trying to help, but the key to my problem is that I use
usetimestamp="true" in my get task. It means that the file will be
downloaded for two cases: 1) The file isn't there to begin with and 2)
The file is there but has a time stamp going back further in time than
the remote file. Your example handle [1] but not [2], and I really
need to handle them both.

More ideas? :-)


On Fri, Jan 9, 2009 at 7:00 PM, Brian Stephenson
<[email protected]> wrote:
> Kent,
>   There may be a more direct way to do this, but I accomplish a similar
> thing this way (I munged my code to match yours):
>
> <available file="${destination.file}" type="file"
> property="dest.file.present"/>
>
> Then the targets following can have the "if" attribute in the target:
>
> <target name="Do_When_File_Is_There" depends="download-ivy"
> if="dest.file.present">
> ...
> </target>
>
> With "available", the designated property is not set if the file does not
> exist.  With the "if", the target is only executed if the property is
> actually set, which it won't be if the destination file does not exist after
> attempted download.
>
> Brian
>
>
> On Jan 9, 2009, at 11:58 AM, Kent Larsson wrote:
>
>> In a target I download a remote file if it's newer than the current
>> local one or if no local copy exists. I do it using the following code
>> and it works as it's supposed to:
>>
>> <target name="download-ivy" unless="skip.download">
>>  <mkdir dir="${destination.dir}"/>
>>  <get src="http://a.com/b.jar"; dest="${destination.file}"
>> usetimestamp="true"/>
>> </target>
>>
>> Now to my problem:
>>
>> I would like to do something if the remote file is actually
>> downloaded. If the remote file is not downloaded I don't want to do
>> these tasks.
>>
>> I've looked through the manual and done some Googling without finding
>> my answer. I'm quite new to Ant so this may still be an easy problem
>> for someone more experienced.
>>
>> Any and all help highly appreciated!
>>
>> Regards, Kent
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>
> Brian Stephenson
> ThorTech Solutions
> www.thortech-solutions.com
> (914) 302-7638  [work]
> (914) 302-7641  [fax]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to