diff options
Diffstat (limited to 'source/install-zip.c')
-rw-r--r-- | source/install-zip.c | 41 |
1 files changed, 41 insertions, 0 deletions
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 <stdio.h> +#include <stdlib.h> +#include <string.h> + +#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 |