I am developing a lightroom plugin and have a requirement to update the plugin with the plugin manager. I am storing all the plugin versions on the server in a zip file. Now I wanted to download and extract that file to the plugin directory. I can download that zip file on the plugin directory but don't have an idea to extract that zip file. The plugin is compatible with windows and mac so I need some solution that can extract that plugin file into the plugin directory. Below is the code for downloading the zip file.
local downloadButton = f:push_button { -- create button
enabled = bind 'downloadButton',
visible = false,
title = "Download",
bind_to_object = prefs,
action = function( button )
local headers = {
{ field = 'Content-Type', value = "application/json" }
}
LrTasks.startAsyncTask(
function()
local url = "https://WEBSITEPATH/assets/plugins/staging/1.3.5/BatchAI.lrdevplugin.zip"
local response, hdrs = LrHttp.get(url,headers)
local saveFile = assert(io.open(downloadPath .. "BatchAI.lrdevplugin", 'wb'))
saveFile:write(response)
saveFile:close()
LrDialogs.message('Plugin updated')
end
)
end
}
If anyone has a solution on how to extract the zip file or any other solution to update the plugin withing the plugin manager, please share your thoughts here. Thank you.