thank you! c u tomorrow.
Hi. This is working fine for me in release 2018.3363.
Try this: https://github.com/roaminggamer/RG_FreeStuff/raw/master/AskEd/2018/09/zip.zip
The example I linked above:
- zips some files from the resource directory into a file named test.zip and puts that zip file in the documents directory.
- one second later it decompresses that zip file into the temporary folder
PS - I tested this on Windows. I’ll leave ‘testing on other OSes’ to all interested parties, but I’m 99.99% sure it will work.
Here is the code:
local zip = require( "plugin.zip" ) local function zipListener( event ) for k,v in pairs( event ) do print(k,v) end if ( event.isError ) then print( "Error!" ) else print ( "event.name: " .. event.name ) print ( "event.type: " .. event.type ) for k,v in pairs( event.response ) do print(k,v) end end end local function doCompress() local zipOptions = { zipFile = "test.zip", zipBaseDir = system.DocumentsDirectory, srcBaseDir = system.ResourceDirectory, srcFiles = { "sonic.png", "pinky.png" }, listener = zipListener } zip.compress( zipOptions ) end local function doUncompress() local zipOptions = { zipFile = "test.zip", zipBaseDir = system.DocumentsDirectory, dstBaseDir = system.TemporaryDirectory, listener = zipListener } zip.uncompress( zipOptions ) end doCompress() timer.performWithDelay( 1000, doUncompress )
Thank you for the code,
i think the problem is with my sandbox name on windows:
C:\Users\Bali János\AppData\Local\Corona Labs\Corona Simulator\Sandbox\ziptest-0FBE77187EC85ACAE06B437B48FD8691
As you see it has a non standard character.
zip.list{ zipFile = "test.zip", zipBaseDir = system.ResourceDirectory, listener = function(event) print( "event.isError:",event.isError ) end }
While the name of my system.resourceDirectory “ZipTest” has only standard characters the zip plugin works.
Output is event.isError: false
Now i changed the project folder to “ZipTest János”.
The output is now: event.isError: true
Please help me how can i report this bug …
You can report a bug using the “Report a bug” link at the top of the forums page.
Please note, in production, you will not be manually copying a .zip file to your user’s tmp sandbox folder. You either have to include the .zip file in your project’s folder (with main.lua) and have code copy the file to a sandbox folder for you or download the file from the Internet somewhere. Your end users won’t have the skills to copy that file around.
While this tutorial talks about SQLite databases, it works for any binary file and can be used to populate your tmp folder with your .zip file from your app bundle:
Rob
Hi.
@roaringgamer:
Thank you for your advices you helped me a lot! I tried your code, but the result was same…
Finally i’m found that the maybe the zip plugin can’t handle international characters in the filepath.
@Rob:
Thank you too. I’ll never try to copy files manually in production environment. I made this small sample to detect why the downloaded file is unaccessible for me from the simulator on windows.
The tutorial is another good example to notice that something wrong in the zip plugin, because using the system.pathForFile(…) always worked for me in my programs to access files at temp or docs dir.
Do you think it’s enough information for a bug report or i need do more tests?
janos
It sounds like there is a problem with UTF-8 characters in path names. That should be sufficient to provide a bug report.
Rob
Update:
I made the final test.
I created a new windows user with no hungarian characters in the username.
Everything is working perfectly now, tested with roaringgamers code.
thank you for helping me
Rob the bug report was provided just now. thx again.
Maybe you should close this topic?
We generally don’t close topics. If you found a particular answer helpful, you can use the “Mark Solved” button.
Rob