From 0349c6d6572f59770898d3f40287ebdcd2f8ed30 Mon Sep 17 00:00:00 2001 From: Gentoo Date: Sat, 27 Mar 2021 10:36:05 +1100 Subject: initial commit --- source/install-zip.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 source/install-zip.c (limited to 'source/install-zip.c') diff --git a/source/install-zip.c b/source/install-zip.c new file mode 100644 index 0000000..93553b3 --- /dev/null +++ b/source/install-zip.c @@ -0,0 +1,41 @@ +#ifndef INSTALL_ZIP_H +#define INSTALL_ZIP_H + +#include +#include +#include + +#include "unzip/unzip.h" +#include "unzip/miniunz.h" + +#include "gecko.h" + +void unZip(char zipFilePath[]) +{ + char newZipFilePath[strlen(zipFilePath)+4]; + sprintf(newZipFilePath, "sd:/%s", zipFilePath); + + unzFile zip = unzOpen(newZipFilePath); + if (!zip) + { + printf("Cannot open %s, aborting\n", newZipFilePath); + #ifndef GECKO + gprintf("Cannot open %s, aborting\n", newZipFilePath); + #endif + exit(1); + } + + printf("%s opened\n", newZipFilePath); + gprintf("%s opened\n", newZipFilePath); +// if (chdir(unzipFolderPath))//can't access dir +// { +// create_folders(unzipFolderPath);//create dir +// chdir(NewUnzipFolderPath);//change to created dir (create_folders() will exit(1) if it can't create the folder) +// } + + extractZip(zip,0,1,0);//extract zip + unzCloseCurrentFile(zip); + printf("Extracted Zip\n"); +} + +#endif -- cgit v1.2.3