www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - ZipExtraction Problem

reply Tyro <nospam home.com> writes:
The following snippet downloads a zipfile from the internet if not resident on
my computer. Problem is, it won't move past this point.
I keep getting the error: "Error: ZipException: no end record." How do I solve
this problem?

    ZipArchive zipFile;
    if(!exists(file))
    {
        char[] result = myCurl.downloadToString();
        write(file, result);
        zipFile = new ZipArchive(file);
    }
    else
    {
        zipFile = new ZipArchive(file);
    }

My program works if I always download the file and work directly with it
instead of saving it. But that is way too time consuming. Also, how would I go
about getting a list of the files on the site so that I can then choose the
most current to work with?

Finally, if I download a file using a browser the copy on my computer has all
the original attributes of the one on the remote server, however, that's not
the case when I use download programmatically. Any pointers on how to do this
correctly?

Thanks,
Tyro
Jun 16 2008
parent Tyro <nospam home.com> writes:
Tyro Wrote:

[snip]
 Also, how would I go about getting a list of the files on the site so that I
can then choose the most current to work with?
[snip] One way I've gotten this to work is by downloading the page containing the link and searching it's contents for the regex string: jDay~"_[0-9]{4}[.EJRIPZ]{7}" jDay contains today’s julian day number in the format "YYDDD". This does the trick but is a still longer than going to the directory on the remote server and searching for the file that matches the regex. Still have not found a solution the other three problems but will keep trying. Any guidance is always greatly appreciated.
 Thanks,
 Tyro
Jun 18 2008