Cannot get any zip files to unzip

mistermentality

Active Member
Licensed User
Longtime User
This a bit embarrassing to ask but I've tried and tried without success so I have to ask for help.

I'm trying to unzip a simple unencrypted totally standard zip file called posters.zip that is stored in the assets directory of my application but nothing is working.

First I tried ABUnzip and then the Archiver library but none work so I'm having to ask if anyone might know why.

The line I use to unzip with archiver library is:
B4X:
Arc.UnZip(File.DirAssets, "posters.zip", File.DirRootExternal & "/mb_posters","")

I've tried it with and without / characters but I always get this error message as soon as the command tries to run:

""java.io.IOException: java.io.FileNotFoundException: /AssetsDir/posters.zip: open failed: ENOENT (No such file or directory".

I know the file is there in the Assets directory (I double checked by going into the folder to check) and I know the folder mb_posters exists but no matter what I try Archiver always gives the exact same error message.

ABUnzip doesn't give me any error message, it just doesn't unzip at all which is why I tried with the archiver library.

I have also tried re making the zip file, in case it was somehow corrupted, but nothing works so far.

I'm using version 2.3 of B4A with the wireless bridge on a stock but rooted Nexus 7 running Android 4.2, could that be causing the unzip command to fail somehow?

Incidentally I have also tried unzipping to internal directory and default external directory with same results so location does not seem to make a difference but something must be stopping what should be an easy task working.

Any help is appreciated, I've spent days trying to figure this out so I'm hoping someone much clever than I can help.

Thanks,

Dave
 

Informatix

Expert
Licensed User
Longtime User
The Assets folder is a virtual place. It doesn't exist physically on your storage device. In fact, all files in the "assets folder" are packed with your binary in the APK file. Some functions like LoadBitmap include some extra code to read files in this special location, but most of functions dealing with files cannot access these files. Hence the errors you get. Solution: copy your file somewhere on your card, then unzip it.
 
Upvote 0

mistermentality

Active Member
Licensed User
Longtime User
The Assets folder is a virtual place. It doesn't exist physically on your storage device. In fact, all files in the "assets folder" are packed with your binary in the APK file. Some functions like LoadBitmap include some extra code to read files in this special location, but most of functions dealing with files cannot access these files. Hence the errors you get. Solution: copy your file somewhere on your card, then unzip it.

Thank you :sign0060:

I can't believe I could have not realised that, wish I'd asked sooner. You've saved me many hours head scratching, thank you :)

Dave
 
Upvote 0
Top