blob: 93553b3b28102678bd554795f84d74053ae1bbba (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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
|