-2

I'm using TZipFile to extract a zip file and it's works ok in win32 but raise this exception in ios simulator. I dont know why , i've checked the location for the extraction is ok, passed the open file but when come to the extract it still raise that exception. Currently i'm not having any ios device for the real testing but please help on simulator, i'm frustrating with this.

ZipFile.Open(filePath, zmRead);//this line passed, 
ZipFile.Extract(0,dirPath );//raise EAccess exception in this line
ZipFile.Close;
//the filePath and the dirPath is the location of file and location i want to extract, it's all correct.

Or use

Zipfile.ExtractZipFile(filePath,dirPath) //still that exception

Update: OH i think i'm missing the information about my project, my working is to download a zip file which contain a .csv file from a server. I've downloaded it to the a folder(create at run time) in the ios simulator, the directory of folder i put in to variable dirPath = Tpath.GetHomePath() + SeparatorChar + 'csv' and the variable 'fileName' is the dirPath' + name of file zip i downloaded. And i about to extract it right in that folder. So i use TZipFile to extract it and it cause up the access violation error in ZipFile.Extract line. I putted my download and extract section code to a new project and it works perfectly. I dont know why but my main project is a large prj which contain many functions and come up before my download section.Thanks

thanh
  • 426
  • 7
  • 16
  • What's the value being passed as `filePath` and `dirPath`? What's the full message of the Access Violation (with addresses)? – Jerry Dodge Sep 10 '15 at 20:45
  • Further, which version of Delphi? – Jerry Dodge Sep 10 '15 at 21:22
  • 1
    Asking a question like this, you have to give full details of compiler, version, environment, etc. – David Heffernan Sep 10 '15 at 22:51
  • Sorry for missing that information @david. My current delphi is xe8 Version 22.0.19027.8951. My simulator is ios 7.1 ipad. The full message is https://i.imgur.com/mTsYErO.jpg, the value filePath and dirPath is the directory i want to extract and the file name, i cheked this value and it's all correct. Thansk – thanh Sep 11 '15 at 01:22
  • 1
    *Access violation* and *raise this exception* are meaningless without the full error message. What is the **specific** message you receive, including any memory addresses? What values are you providing in `filePath` and `dirPath` **specifically**? *The directory I want to extract* means nothing, as we don't know what directory **you** want to extract. *it's all correct* just means it's what you think it should be, not that it's *correct*. We can't see what you're thinking, and we can't see any code you haven't included. If you want help, provide details. – Ken White Sep 11 '15 at 03:02
  • Sorry for my bad question and the information i provided @KenWhite, i just created another project for test the extraction of `TzipFile` unit and everything works fine. The value of `filePath` and `dirPath` are the string of directory i got in `Tpath.GetHomePath()` method. And I dont understand the `full error message`, can you show me where is it? It does not jump in the `EZipException` that i defined. – thanh Sep 11 '15 at 06:38
  • If you've seen an error message so that you are able to report that one occurred, you just need to copy verbatim the entire message into an edit to the question. Then we can see what you are seeing. – David Heffernan Sep 11 '15 at 08:28
  • 1
    *I just created another project for test the extraction of `TZipFile` unit and everything works fine* - Good. That means you've proven that the problem is in your real code. You've still not provided the details necessary for us to try and help you locate it. Have you tried using the debugger? – Ken White Sep 11 '15 at 13:35
  • 1
    @KenWhite It could still be an RTL bug or a compiler bug perhaps. But we would need a repro as you say. – David Heffernan Sep 11 '15 at 14:11
  • @KenWhite Yes i'm using the debugger and i updated my working in the question section. Thanks. – thanh Sep 11 '15 at 16:13
  • 1
    @thanh Based on the Acces Violation that you have shown in the picture from one of your comments (that information should have been added to the question itself) I suspect that somewhere in your program you have and uncreated class or uninitialized variable that your program is trying to access. In order to find where this is I recommend you place breakpoint on `ZipFile.Extract(0,dirPath );` line and then step through your project by using F7 key. This will force the debugger to also step into the ZLib library code. – SilverWarior Sep 11 '15 at 20:47

1 Answers1

0

Problem solved, in my Download.pas is a separated class and i use library System.Zip in there and i use another class to call it. So my work around is put uses System.Zip right in the Main form when project start and problem solved, there is no logical here and i think it's a bug from System.Zip. Thanks

thanh
  • 426
  • 7
  • 16