Compress a file with JclCompression

2.5k views Asked by At

I am trying to save (compress) a .zip file using JclCompression with the JCL Demo. When I press the Save button on the Read and Write Tab the demo calls:

procedure TFormMain.ActionSaveExecute(Sender: TObject);
begin
  (FArchive as TJclCompressArchive).Compress;
  CloseArchive;
end;

When (FArchive as TJclCompressArchive).Compress; is executed it produces an exception: "At least one compression volumes could not be replaced after an archive out-of-place update." Also sometimes when I press the save button, the "application is not responding" appears in the form's caption, so I have to shutdown the demo.

Is this code correct or do I have to change it to sucessfully compress and save the zip file? Are there any other demos for JclCompression so I can learn how to use these classes?

Aside from this problem the demo seems to be working correctly. I can open a zip file, create a new zip file, add files, add files from a directory, extract selected files, extract all, and get zip file properties. Saving seems to be a problem.

I am using Delphi 2010 on Windows 7.

2

There are 2 answers

0
TridenT On BEST ANSWER

Same issue as jedi-jcl-compression-library-wont-open-spanned-archive-files. JEDI JCL Compression library wont open spanned archive files

The JCL-JVCL version you use is buggy.
I would recommand to upgrade your JCL installation to latest daily build

1
Mic On

I saw this error message when files which I wanted to archive were opened for writing, so you need to close them or copy them to temp folder in advance. Also If you using function Create7zArchive() as i do you need 7z.dll placed in your bin output folder. It's sad, but it seems JCL doesn't use Zlib.pas which is already integrated in Delphi.

JCL 2.7.0.5676 (Stable)