| 3921 | } |
| 3922 | |
| 3923 | ZRESULT TUnzip::Find(const TCHAR *tname,bool ic,int *index,ZIPENTRY *ze) |
| 3924 | { char name[MAX_PATH]; |
| 3925 | #ifdef UNICODE |
| 3926 | WideCharToMultiByte(CP_UTF8,0,tname,-1,name,MAX_PATH,0,0); |
| 3927 | #else |
| 3928 | strcpy(name,tname); |
| 3929 | #endif |
| 3930 | int res = unzLocateFile(uf,name,ic?CASE_INSENSITIVE:CASE_SENSITIVE); |
| 3931 | if (res!=UNZ_OK) |
| 3932 | { if (index!=0) *index=-1; |
| 3933 | if (ze!=NULL) {ZeroMemory(ze,sizeof(ZIPENTRY)); ze->index=-1;} |
| 3934 | return ZR_NOTFOUND; |
| 3935 | } |
| 3936 | if (currentfile!=-1) unzCloseCurrentFile(uf); currentfile=-1; |
| 3937 | int i = (int)uf->num_file; |
| 3938 | if (index!=NULL) *index=i; |
| 3939 | if (ze!=NULL) |
| 3940 | { ZRESULT zres = Get(i,ze); |
| 3941 | if (zres!=ZR_OK) return zres; |
| 3942 | } |
| 3943 | return ZR_OK; |
| 3944 | } |
| 3945 | |
| 3946 | void EnsureDirectory(const TCHAR *rootdir, const TCHAR *dir) |
| 3947 | { if (rootdir!=0 && GetFileAttributes(rootdir)==0xFFFFFFFF) CreateDirectory(rootdir,0); |
no test coverage detected