Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Zip compress not working
Started by nmichaud Sep 19 2015 10:20 AM

- - - - -
22 replies to this topic
zip

Best Answer Michael W. , 06 November 2015 - 04:26 PM

This issue should now be fixed.

Additionally, you should get an error sent to your listener for more cases (such as missing parameters, files, etc.).

 

Give it a whirl and let us know if you encounter any issues.

[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

nmichaud

[GLOBAL: userInfoPane.html]
nmichaud
  • Contributor

  • 492 posts
  • Corona SDK

Hi all,

 

Is it only me, but I try to compress a few files with the zip plug-in, but only the last file is added. I even try the sample provided by the Corona plugin help page and I am getting the same result; only the last item is part of the final zip.

 

Nick

 



[TOPIC: post.html]
#2

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 7,587 posts
  • Corona SDK

As always, to help with a specific question like this we need specific details to help us match your setup.

 

1. Which version of Corona are you using?  For example, I'm using 2015.2716.

 

2. What systems have you tested this on?

  • Simulator on OSX
  • Simulator on Windows 7 / 8 / or 10?
  • Android (what OS version)
  • iOS (what OS version and what device(s) )


[TOPIC: post.html]
#3

nmichaud

[GLOBAL: userInfoPane.html]
nmichaud
  • Contributor

  • 492 posts
  • Corona SDK

Hi roaming, you are so right and I am sorry about that.

 

I am using 2015.2697

Problem on Windows 7 Simulator and Android 5.0.2



[TOPIC: post.html]
#4

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 7,587 posts
  • Corona SDK

Also please link to the example you used.  I found an unzip test, but no zip test so far...don't like to have to search to help.

 

Going out for now...back later.



[TOPIC: post.html]
#5

nmichaud

[GLOBAL: userInfoPane.html]
nmichaud
  • Contributor

  • 492 posts
  • Corona SDK

Example taken from Corona help file : https://docs.coronalabs.com/plugin/zip/compress.html#options.srcbasedir-required

local zip = require( "plugin.zip" ) 

-- Attempts to compress files in the "filenames" parameter to "test.zip".

local function zipListener( event )

    if ( event.isError ) then
        print( "Error!" )
    else
        print ( "event.name: " .. event.name )
        print ( "event.type: " .. event.type )

        --example response
        --event.response = {
        --[1] = "space.jpg",
        --[2] = "space1.jpg",
        --}
    end
end

local zipOptions = { 
    zipFile = "test.zip",
    zipBaseDir = system.DocumentsDirectory,
    srcBaseDir = system.ResourceDirectory,
    srcFiles = { "space.jpg", "space1.jpg", "space2.jpg" },
    listener = zipListener
}
zip.compress( zipOptions )


[TOPIC: post.html]
#6

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 7,587 posts
  • Corona SDK

Ah, I see.  That's not what I understood when you said 'plugin help page'.  I thought you meant the github link off the store page...

 

Regardless, just wanted to start in the same place as you and we're on the same page now.

 

I've written a sample and tested it.  

http://github.com/roaminggamer/RG_FreeStuff/raw/master/AskEd/2015/09/zip.zip

 

My example zips up two PNG files and as you've seen, only the last one is getting stored.

 

To debug, I added a little more output to see what the listener is seeing:

type    compress
name    zip
errorMessage
isError false
response        table: 03B7F460
event.name: zip
event.type: compress
0       pinky.png

The last line gives me a clue.  It looks like the indexing is hosed up.  See how 'pinky.png' is stored at index 0?  That should be 1 or higher.  So, if I were to warrant a guess I'd say the indexing code in the zip plugin is not getting initialized and/or incremented so all objects are listed at '0' and the last one is the only one found when it is time to zip.

 

I think you can submit this as a bug at this point and use the above linked code (download if needed) to submit the bug.

 

Note however.  I think you can get the plugin code and probably find the exact source of this issue:

 

I would totally understand if you simply filed a bug though and I concur that it is likely a bug.

 

 

PS - Additional details for your bug filing.  This seems to fail on:

  • 2015.2697 for OSes you mentioned 
  • 2016.2716 for Simulator running under  Windows 10 (my current primary setup)

So is may be the 'core' zip code (if there is a common set) as it is showing in multiple places.


Edited by roaminggamer, 19 September 2015 - 11:29 AM.


[TOPIC: post.html]
#7

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 7,587 posts
  • Corona SDK

@Nick,

 

Hi.  If you do file a bug, please post the bug number here too.  That's usually good for when Rob, Brent, and the crew read these posts.

 

If you don't want to file the bug, I will after one more double check.  This does look like a bug, but I'll double check when I'm better focused.

 

Cheers,

Ed

 

PS - I hope I was't being too short w/ you earlier.  I was in a mad rush to get out of the house, but wanted to see if I could figure out the issue.



[TOPIC: post.html]
#8

nmichaud

[GLOBAL: userInfoPane.html]
nmichaud
  • Contributor

  • 492 posts
  • Corona SDK

@roaminggamer,

 

Do not worry about being too short, I can manage :) and you were right with your comments to be more precised, We did not have time to report the bug yet as we did a work around for the time being. If you want to report it with all the details you mention, it would be nice. If not, do not worry, we will report it.

 

PS: English is not my primary language, so I may do a few mistakes.

 

Nick



[TOPIC: post.html]
#9

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,921 posts
  • Enterprise

If you file a bug report, please include this forum thread in the text of the bug report too. It will be good for the engineers to see this discussion.

 

Rob



[TOPIC: post.html]
#10

nmichaud

[GLOBAL: userInfoPane.html]
nmichaud
  • Contributor

  • 492 posts
  • Corona SDK

A bug report (42901) has been submit.



[TOPIC: post.html]
#11

nmichaud

[GLOBAL: userInfoPane.html]
nmichaud
  • Contributor

  • 492 posts
  • Corona SDK

@Rob, do you think its possible to know if this is a bug that will get a short term attention or it could take time ?

 

thank you

Nick



[TOPIC: post.html]
#12

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,921 posts
  • Enterprise

We are working on a new public build. We are only fixing core bugs until this is out (unless it's super critical). Plugins can be fixed outside of the core build cycle. In preparation for this, we are focused on regression bugs, iOS 9 minimum support, Android 6 features (though those will probably not make the public release).

 

Rob



[TOPIC: post.html]
#13

nmichaud

[GLOBAL: userInfoPane.html]
nmichaud
  • Contributor

  • 492 posts
  • Corona SDK

Ok, thank you @Rob for the info.

 

Nick



[TOPIC: post.html]
#14

nmichaud

[GLOBAL: userInfoPane.html]
nmichaud
  • Contributor

  • 492 posts
  • Corona SDK

@Rob, now that the new public version is release, any chance we could see this bug fixed quickly as it prevent us from zipping multiple files.

 

thanks

Nick



[TOPIC: post.html]
#15

alireza.rou13

[GLOBAL: userInfoPane.html]
alireza.rou13
  • Observer

  • 24 posts
  • Corona SDK

I have same problem and I install latest daily build and it's not fixed. :wacko:  



[TOPIC: post.html]
#16

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,921 posts
  • Enterprise

Plugins like the Zip plugin are in no way tied to daily builds. A new daily build won't fix problems with plugins. Plugin fixes are released independently of daily builds.

 

The one exception is if a plugin needs a feature of a daily build, like supporting the iOS 9 SDK. or like the Google Play plugin (for admob) requires Android 2.3, so you can't use it on a version older than where we changed the minimum Android support to 2.3.

 

We may make note of plugin fixes in daily build release notes, but that's the only place we have to update you on plugin updates.



[TOPIC: post.html]
#17

nmichaud

[GLOBAL: userInfoPane.html]
nmichaud
  • Contributor

  • 492 posts
  • Corona SDK

@Rob, I do understand what you are saying, but do you have an idea of when the zip plugin will be fixed ?



[TOPIC: post.html]
#18

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,921 posts
  • Enterprise

No. I asked Engineering to see where it is on their todo list. But I asked late last night and with it being the weekend, I don't expect a response until office hours next week.

 

Rob



[TOPIC: post.html]
#19

alireza.rou13

[GLOBAL: userInfoPane.html]
alireza.rou13
  • Observer

  • 24 posts
  • Corona SDK

I fix my problem with for loop.

this zip plugin when compress a file if file exist added new file to old compress.

I have an array with files name and ...

local function zipListener( event )
	if ( event.isError ) then
	        print( "Error!" )
	else
	    for k,v in pairs(event.response) do
	    	local lastst=table.getn(attach_images)
	    	if (attach_images[lastst]==v) then
	    		print("I'll done...")
	    		--your other code after attach all file
	    	end
	    end
	end
end
for i=1,table.getn(attach_images) do
   zipOptions = { 
	zipFile = "images.zip",
	zipBaseDir = system.TemporaryDirectory,
	srcBaseDir = system.TemporaryDirectory,
	srcFiles = {attach_images[i]},
	listener = zipListener
	}
   zip.compress( zipOptions )
end


[TOPIC: post.html]
#20

nmichaud

[GLOBAL: userInfoPane.html]
nmichaud
  • Contributor

  • 492 posts
  • Corona SDK

@Rob, any answer from the development team ? On our side we need to take the decision about what we do as our app rely on zipping multiple files. We could do something like @alireza.rou13, but its not very elegant.



[TOPIC: post.html]
#21

nmichaud

[GLOBAL: userInfoPane.html]
nmichaud
  • Contributor

  • 492 posts
  • Corona SDK

@Rob any news ?

 

If you think Corona cannot fix this quickly, you should put a note in the plugin, that zipping multiple files does not work.



[TOPIC: post.html]
#22

Michael W.

[GLOBAL: userInfoPane.html]
Michael W.
  • Contributor

  • 276 posts
  • Alumni

  Best Answer

This issue should now be fixed.

Additionally, you should get an error sent to your listener for more cases (such as missing parameters, files, etc.).

 

Give it a whirl and let us know if you encounter any issues.



[TOPIC: post.html]
#23

nmichaud

[GLOBAL: userInfoPane.html]
nmichaud
  • Contributor

  • 492 posts
  • Corona SDK

Hi Michael,

 

I confirm that it is working perfectly. Thank you very much.

 

Nick




[topic_controls]
[/topic_controls]