1 (edited by Grisu 2010-07-24 17:06:33)

Topic: zrObject.ExtractFileToDisk - Unhandled Exception

Function Extract_Zip()

      Local zrObject:ZipReader = New ZipReader
      Local Extracted_file:String
      Local Scr_file:String 

      SetGadgetText(Curr_Msg_Lab,"Extracting File: ")
    
      If ( zrObject.OpenZip(ServerZIPFile) ) Then

      For Local i:Int=1 To zrObject.getFileCount()-1
                 Scr_file:String=zrObject.getFileInfo(i).zipFileName  
                 Extracted_file=Replace(Scr_file,"Pocket Radio Player/","")

           If Extracted_file.find(".")>0 Then zrObject.ExtractFileToDisk(Scr_file, Extracted_file, True) <- This one!!

         Next

        zrObject.CloseZip()
    End If
        
End Function

Re: zrObject.ExtractFileToDisk - Unhandled Exception

A workaround for the crash is to check each file with "openfile(file,false,true)".
If one can't open them for writing, I skip the extraction of this file.

Perhaps there's a more elegant way to solve this issue?

Re: zrObject.ExtractFileToDisk - Unhandled Exception

greetings smile  i should be able to get to the issues this evening.  if you could whip up a running example with zip files included it would be much appreciated.

Re: zrObject.ExtractFileToDisk - Unhandled Exception

greetings smile  please download the latest release as it should resolve your issues.  for an added ability to detect issues (ie file in use), ExtractFileToDisk now returns true/false based on success.

Re: zrObject.ExtractFileToDisk - Unhandled Exception

Great, seems to work so far. Got to test it more....

BtW: Is it normal that extraction of a file destroys the "timestamp"?

Re: zrObject.ExtractFileToDisk - Unhandled Exception

greetings smile  glad its all fixed up!  i had not implemented setting of the timestamp.  i have done so and uploaded a new version.  lmk how it works for you smile

Re: zrObject.ExtractFileToDisk - Unhandled Exception

Thanks for your long time support. Not many people are that dedicated. Works fine so far...

I recently discovered another smaller issue: When I extract a zip file including other zips with  filenames including German umlauts ("ä","ö","ü"), the names of the extracted files seem to be broken.

Haven't come up with a proper example code yet.

Re: zrObject.ExtractFileToDisk - Unhandled Exception

you are very welcome smile  happy that someone is getting use from my work!  the name issue is probably related to unicode support.  ZLib does not use wide chars so it will have issues with unicode characters.

Re: zrObject.ExtractFileToDisk - Unhandled Exception

I think, I'll have to live with this then. Thanks for your informations.