I have the following code that always fails with an “Abstract Error”:
arch := TJclCompressArchive.Create(GetDesktop + 'Support.7z');
try
with arch do
begin
if FindFirst('*.log', faAnyFile, sr) = 0 then
begin
repeat
AddFile(ExtractFileName(sr.Name),sr.Name);
until FindNext(sr) <> 0;
FindClose(sr);
end;
Compress; //this line throws the error
end;
finally
arch.free;
end;
However, I always get that error when trying to Compress. Any ideas on what I’m doing wrong here?
I believe you have to tell it which kind of JclCompressArchive to create, such as give it
arch := TJcl7zCompressArchive.Create...instead of JclCompressArchive.Create().If you look at the “Class Hierarchy” section of JclCompression.pas:
Update
I think the proper way to use StackOverflow would have been to add a new question, since after the update, it’s a completely different question.
I don’t know why you’re casting to TJclCompressArchive to AddFile() and Compress(), it seems to work for me without the casts