|
Post by Stefan on Oct 20, 2005 6:47:54 GMT -5
Hi!
Adding an empty directory to a zipfile is not a problem. But unfurtunatly unzipping these directories seems not to work.
Guess the zipfile has the following structure:
dirA\file1.abc dirB\ dirC\file2.abc
I add alle the files to the FilesList:
zipper.FilesList.Add('dirA\file1.abc'); zipper.FilesList.Add('dirB\'); zipper.FilesList.Add('dirC\file2.abc'); ... zipper.UnZip;
The zipper just handels the files skips the direcotries. You can observe this within the the OnStartUnzip event:
First call of OnStartUnzip: FileIndex = 0, FName = dirA\file1.abc Second cal of OnStartUnizp: FileIndex = 2 (!!!), FName = dirC\file2.abc
So, what to do to unzip empty directories???
Thanks Stefan
|
|
|
Post by Kevin on Oct 20, 2005 20:57:00 GMT -5
Stefan,
Do you have the property StorePaths set to true during zipping and RecreateDirs set to True during unzipping? This should cause the empty directory to be created.
Kevin
|
|
|
Post by Stefan on Oct 21, 2005 1:17:50 GMT -5
Hi Kevin!
Yes, both properties are true while zipping aswell while unzipping.
I am jusing the new version 3.06 of VCLZip Pro.
Any other ideas?
Stefan
|
|
|
Post by Kevin on Oct 21, 2005 6:35:05 GMT -5
Is the entry for the empty directory in the zip file? Did it get zipped? It should be an entry with filename = "" but it should have a pathname.
Kevin
|
|
|
Post by Stefan on Oct 21, 2005 7:41:17 GMT -5
Hi!
Yes, zipping the empty dirs ist no problem, the dirs apear in the zip file:
> It should be an entry with filename = "" but it should have > a pathname.
This is correct. Guess the zipfile has the structure discribed in my first posting. In this case I get the following results:
FileName[0]=file1.abc, PathName[0]=dirA\ FileName[1]='' , Pathname[1]=dirB\ FileName[2]=file2.abc, PathName[2]=dirC\
So the content of the zipfile seems to be OK. But how can I extract the empty dirs?
Stefan
|
|
|
Post by Kevin on Oct 25, 2005 6:54:01 GMT -5
Hi Stephan,
I was away for the weekend. I'll check on that today.
Kevin
|
|
|
Post by Kevin on Oct 25, 2005 17:36:31 GMT -5
Stephan,
I have tested this here, and it is working as it should. As long as I set StorePaths to true when zipping, and RecreateDirs to True when unzipping, it works fine.
Are you setting DestDir when unzipping so you know where the directory is being created?
Below is the code I am using to test this. As a result of the extract code, a subdirectory called test is created under c:\temp. That is, c:\temp\test is created.
procedure TForm1.AddBtnClick(Sender: TObject); begin DeleteFile('c:\temp\dir.zip'); VCLZip1.ZipName := 'c:\temp\dir.zip'; VCLZip1.StorePaths := true; VCLZip1.FilesList.Add('test\'); VCLZip1.Zip; VCLZip1.ClearZip; end;
procedure TForm1.ExtractBtnClick(Sender: TObject); begin VCLZip1.ZipName := 'c:\temp\dir.zip'; VCLZip1.FilesList.Add('test\'); VCLZip1.DestDir := 'c:\temp\'; VCLZip1.RecreateDirs := true; VCLZip1.UnZip; end;
Kevin
|
|