0

I am having trouble unzipping files using the Delphi 3rd Party component FlexCompress. Here is the Code, detailed explanation after the code:

MyZipReader            := TFlexCompress.Create(myComponent);
MyZipReader.Name       := 'MyReader';
MyZipReader.FileName   := DataPath; //e.g. C:\Users\thisUser\AppData\Local\Temp\ThisTempFolder\ThisZip.zip
MyZipReader.OpenArchive(fmOpenRead);
MyZipReader.BaseDir    := BasePath; //e.g. C:\Users\[...]\ThisTempFolder\UnzipHere\
MyZipReader.CreateDirs := TRUE;
MyZipReader.ExtractCorruptedFiles := TRUE;
MyZipReader.ExtractFiles          := ('*.*');
MyZipReader.closeArchive;

All files will be extracted and placed accordingly, so that's OK.

BUT: All files are empty. No text no nothing.

I have no idea what I am doing wrong. If I extract an archive I packed with Flexcompress everything is OK but if I try this with an external archive this behaviour occurs. Is there some sort of switch I am missing? I would be grateful about every tip or idea! I also tried the options ReplaceReadOnly and overwriteMode. Did not help and I am out of Ideas. If anyone knows some sort of FlexCompress forum I would also appreciate a link, maybe I could find info there? Sadly componentAce does not seem to host something like this.

Edit(2021.12.14 - 1.17pm) Extra information gathered in the process: One should not set the ExtractCorruptedFiles property to TRUE. This will prevent the eventhandler from raising an exception within the extractFiles() procedure

kishmet
  • 33
  • 1
  • 6
  • 1
    Wild guess: 32bit vs. 64bit .ZIP file? Do you know if FlexCompress supports 64bit .ZIP files (can you make a .ZIP file with that library that is larger than 4Gb and/or include files larger than 4Gb in the .ZIP file)? – HeartWare Dec 14 '21 at 10:19
  • 1
    I'm not familiar with FlexCompress but based on the fact that you end up with empty files I'm guessing your application might be blocked by UAC (try running your application as administrator) or by Anti Virus software which prevents writing into those files. I'm also guessing that FlexComponent also has events that can be fired in case when errors occur since no AV is raised. Use those events to get better idea of what might be preventing proper extraction of your files. – SilverWarior Dec 14 '21 at 11:13
  • @HeartWare Good Idea! Sadly that does not seem to be the Problem. Just packed up huge amounts of Data. The website also states something with 2^63 bytes... – kishmet Dec 14 '21 at 11:27
  • @SilverWarior Well it is for sure not an Antivirus problem or sth. like that but the idea with those events was good. I only checked after the process I just added one before the extraction. Seems like I might have a problem with the used compression format... Maybe a Zip Header problem. I'll keep you informed. – kishmet Dec 14 '21 at 11:44
  • 1
    Looking at documentation of [FlexCompress](https://www.componentace.com/help/fxc_guide/flexcompress_content.htm) you should handle [OnProcessFilefailiure event](https://www.componentace.com/help/fxc_guide/onprocessfilefailure.htm) to get proper information of why processing of certain file has failed. – SilverWarior Dec 14 '21 at 11:58
  • @SilverWarior That event is already called as soon as an error occurs. I must but say that the `ExtractCorruptedFiles` was the culprit of why I did not earlier get the information of a problem with the compression format. One should not use that... Well I have written them a message regarding this topic. Maybe I will get an explanation there. But I think this component is just not capable of handling usual Zip files. – kishmet Dec 14 '21 at 12:12
  • Is there anything wrong with the built in ZIP file library? – David Heffernan Dec 14 '21 at 12:26
  • @DavidHeffernan I hope not, since its what I wanted to use now... – kishmet Dec 14 '21 at 12:29

0 Answers0