Couldn't uncompress file from system.TemporaryDirectory

@bali - So you downloaded and ran my example and it did not work?

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

so you are trying to unzip a file from temp directory to temp directory using the same source and destination filenames, and wonder why you get a file exist error?  :wink:

how is test.zip getting into the temporary directory? i.e. before you try to unzip it.

Thank you for the replies!

@anaquim:

the real problem is that i can use unzip if the basedir is NOT the resourcedir.

e.g: if the zipBaseDir equals with the system.DocumentsDirectory i get the same error

@roaminggamer:

manually copied. 

Have you tried setting the destination directory to a different one than the source directory? I havent used zip in a long time so dont remember much except that it works.
Usually syntax problems like these can be solved by studying the corona documentation.

i tried all combinations…

list or uncompress works without error only if zipBaseDir set to system.ResourceDir

local unzipOptions = { zipFile = "test.zip", zipBaseDir = system.ResourceDirectory, dstBaseDir = system.TemporaryDirectory, listener = function(event) if ( event.isError ) then print("ERROR:",event.errorMessage) else for k,v in pairs(event.response) do print(k,v.file) end end end } local f = io.open(system.pathForFile("test.zip",system.ResourceDirectory),"r") if f then print("File exists") io.close(f) end zip.list(unzipOptions) 

in this case the output is correct:

> File exists

> 1 data.json

Update: 

the problem not occours on mac!

copied manually the test.zip file to projects sandbox tmp folder, the output is correct when zipBaseDir=system.TemporaryDirectory

anybody can check the windows version? 

what OS did you originally have the issue on?

“Testing environment was the Corona simulator on windows.”

win10

checking the documentation I find that you are using options (dstBaseDir) not required to make a zip.list

if that has something to do with it or not, you need to test yourself.

every time i am stuck, going back to documentation with a magnifying glass often solves the problem.

https://docs.coronalabs.com/plugin/zip/list.html

I use zip in a windows app I have on the marketplace running on windows and mac without issues, so this has to be a syntax issue, unless something has changes regarding folder permissions, which I doubt.

you are rigth anaqim, the best example is to try to run example from the docs.

it’s working on mac, but not on windows. just tested.

Let us know what you find out :grinning:

Example from: https://docs.coronalabs.com/plugin/zip/list.html

can you test it on windows? i’m totally lost.

local zip = require( "plugin.zip" ) local function zipListener( event ) if ( event.isError ) then print( "Error!" ) else print ( event["type"] ) --\> list print( event.response ) --\> [1] = table: 0x618001466580 { --\> ratio: 98 --\> size: 2188295440 --\> file: space.jpg --\> [2] = table: 0x618001466580 { --\> ratio: 98 --\> size: 2188295440 --\> file: space1.jpg end end -- List all files from "test.zip" with additional file info local zipOptions = { zipFile = "test.zip", zipBaseDir = system.DocumentsDirectory, listener = zipListener } zip.list( zipOptions )

I can try tomorrow. Its 1am here so just typing on the phone while watching netflix :grinning: