I’m working on two projects at the same time, but they were created on two different dates. I use the same code on both projects to compress a single file. In the oldest project the file is compressed but doubles the file inside the zip. in the second I get an error followed by “The stdin connection has closed.”
Can someone explain to me how this plugin works.
should it be downloaded for each project or once it is in the simulator is it valid for all new projects?
here is the code.
local zip = require( "plugin.zip" )
local function zipListener( event )
if ( event.isError ) then
print( " Error!" )
else
print ( event["type"] ) --> compress
print ( event.response[1] ) --> myfile.txt
end
end
local zipOptions = {
zipFile = "module1.zip",
zipBaseDir = system.DocumentsDirectory,
srcBaseDir = system.DocumentsDirectory,
srcFiles = {"myfile.txt"},
listener = zipListener
}
zip.compress( zipOptions )
Did you add the plugin in build.settings? This is required for all plugin before they can be used.
If it is in build.settings then the Simulator will fetch or update the required plugin file.
EDIT:
A couple of things to note:
Whether you have it in build.settings or not, a notice should show up in the console.
If you’re missing the source file or the plugin itself, it shouldn’t cause a Simulator crash (“The stdin connection has closed).
For each time you try to zip, the file will be added in the same zip file you specified.
I have a first project whose “plugin.zip” works normally. I make a new project like this: I copy all the working project files including build.setting and main.lua into the new project. it does not work !!!
I guess the plugin.zip requires a download for each project!!!
It looks like you’ll have some troubleshooting to do, but one thing I can confirm is that the plugin gets cached and it’s available for any project that you include it in for the Simulator.
You may as well just copy your project folder and rename it to your new project if that makes it easier for you.