[delphizip] Re: CopyZippedFiles

  • From: "Roger Aelbrecht" <Roger.Aelbrecht@xxxxxxxxxx>
  • To: <delphizip@xxxxxxxxxxxxx>
  • Date: Thu, 19 Sep 2002 18:54:49 +0200

----- Original Message -----
From: "gslurink" <gslurink@xxxxxx>
To: <delphizip@xxxxxxxxxxxxx>
Sent: Thursday, September 19, 2002 9:33 AM
Subject: [delphizip] CopyZippedFiles


>
> Hi all,
>
> I am trying to use CopyZippedFiles to copy files from one
> zip to another. I have noticed two things:
>
> 1) It seems that CopyZippedFiles does not take wildcards.
> Is this complicated to add in a future version ?
>
No, wildcards are not allowed,
It is complicated and personally I think the application should take care of
it.


> 2) When I try to use CopyZippedFiles to copy files
> to a new created file (by assigning a new name to
> ZipMaster.ZipFileName) I get the message:
> 'Destination zip archive could not be opened.'
> I  guess because  CopyZippedFiles tries to open
> the original destination file with fmOpenRead:
>
I think you are not using this function as it wasintended,
Copy works only from one archive to another, opening the zipfile
is far more than a openread

> // Open the second input archive, i.e. the original destination.
>   In2FileHandle := FileOpen(DestZipMaster.ZipFileName, fmShareDenyWrite or
> fmOpenRead);
>
> I am not sure if it would be sufficient to add a check
> here and open with fmOpenCreate if it is a new file
> or if I must create an empty destination file on the disk
> first. How can I create an empty zip file ?
>
No it is not sufficient to open the new file with openCreate, we have to
build
a complet archive with central directory etc..
Furthermore the function has to work with SFX files as well and there on
creation we have to add the sfx part.

The easiest way is to copy a zipped file froman archive to an new zipfile is
to extract the file first to a temp dir and then add it to a new archive.


> Gerard.
>
>

I am still open for other opinions and suggestions


Roger Aelbrecht
http://web.wanadoo.be/driehoeksw


Other related posts: