11-05-2020, 04:10 PM
(This post was last modified: 11-08-2020, 12:00 PM by Rick Johnson.)
I ended up using this to extract zip files: https://github.com/kuba--/zip
You just need three files: zip.h, zip.c and miniz.h.
The only code needed to expand the archive looks like this:
It works well on both Mac and Windows. Be aware that if an archive contains a .DS_Store file, the zip_extract function will fail. I only extract zip archives that I previously made, and the script that creates them automatically excludes .DS_Store.
To convert my GET data to a zip file, here's a bigger chunk of code:
This is the last piece I need to place updated plugins directly into the user's plugins folder. :-)
You just need three files: zip.h, zip.c and miniz.h.
The only code needed to expand the archive looks like this:
Code:
int zipResult = zip_extract(zipPath.c_str(), tempFolderPath.c_str(), NULL, NULL);
It works well on both Mac and Windows. Be aware that if an archive contains a .DS_Store file, the zip_extract function will fail. I only extract zip archives that I previously made, and the script that creates them automatically excludes .DS_Store.
Code:
do shell script "cd " & myLocation & "; zip -r " & zipFile & " " & myFolderName & " -x *.DS_Store __MACOSX"
To convert my GET data to a zip file, here's a bigger chunk of code:
Code:
std::string theGETdata = this->iGET->content();
free (this->iGET);
this->iGET = NULL;
std::string sTempFolder = HDI_CORE_ILLUSTRATOR->folderPath(hdi::core::Illustrator::TemporaryFolder);
std::string zipPath = sTempFolder + "zipFile + ".zip";
std::ofstream outfile(zipPath.c_str(), std::ofstream::binary);
outfile << theGETdata;
outfile.close();
int zipResult = zip_extract(zipPath.c_str(), sTempFolder.c_str(), NULL, NULL);
std::remove(zipPath.c_str());
This is the last piece I need to place updated plugins directly into the user's plugins folder. :-)