more problems with ftp

Dave Cragg dcragg at lacscentre.co.uk
Mon Sep 13 05:08:46 EDT 2004


On 13 Sep 2004, at 00:32, Alex Tweedly wrote:

>
> 3. When you do the same with an ftp format URL, the local file will 
> have been created - but it will still be open. (Don't know if this is 
> always the case, but it has been in all my testing in the last hour or 
> so).
>
> I have had to add the line
>
>    if cacheName is in the openfiles then close file cacheName
>
> to my downloadComplete handler so that ftp:// files are properly 
> closed (otherwise they are not available for other operations such as 
> rename until Rev closes).
>
> I don't know if this is a bug, or if this difference between http:// 
> and ftp:// forms is intentional.
>
Looks like a bug. There should be no difference between http and ftp 
downloads to file, but it seems I managed to mess up here. (At some 
point, I added some cute stuff for closing files when doing uploads and 
it looks like I overlooked that this might interfere with downloads.)

By the way, libUrlDownloadToFile was only added for dealing with huge 
files that might not fit in available memory. If dealing with "normal" 
files, I'd recommend using simple gets and puts.

get url "ftp://whatever"
if the result is empty then
   put it into url "binfile: whatever"
else
   ##error stuff
end if

Cheers
Dave



More information about the use-livecode mailing list