Try locate the file szFileName in the zipfile. For the iCaseSensitivity signification, see unzStringFileNameCompare return value : UNZ_OK if the file is found. It becomes the current file. UNZ_END_OF_LIST_OF_FILE if the file is not found
| 3238 | // UNZ_OK if the file is found. It becomes the current file. |
| 3239 | // UNZ_END_OF_LIST_OF_FILE if the file is not found |
| 3240 | int unzLocateFile (unzFile file, const char *szFileName, int iCaseSensitivity) |
| 3241 | { |
| 3242 | unz_s* s; |
| 3243 | int err; |
| 3244 | |
| 3245 | |
| 3246 | uLong num_fileSaved; |
| 3247 | uLong pos_in_central_dirSaved; |
| 3248 | |
| 3249 | |
| 3250 | if (file==NULL) |
| 3251 | return UNZ_PARAMERROR; |
| 3252 | |
| 3253 | if (strlen(szFileName)>=UNZ_MAXFILENAMEINZIP) |
| 3254 | return UNZ_PARAMERROR; |
| 3255 | |
| 3256 | s=(unz_s*)file; |
| 3257 | if (!s->current_file_ok) |
| 3258 | return UNZ_END_OF_LIST_OF_FILE; |
| 3259 | |
| 3260 | num_fileSaved = s->num_file; |
| 3261 | pos_in_central_dirSaved = s->pos_in_central_dir; |
| 3262 | |
| 3263 | err = unzGoToFirstFile(file); |
| 3264 | |
| 3265 | while (err == UNZ_OK) |
| 3266 | { |
| 3267 | char szCurrentFileName[UNZ_MAXFILENAMEINZIP+1]; |
| 3268 | unzGetCurrentFileInfo(file,NULL, |
| 3269 | szCurrentFileName,sizeof(szCurrentFileName)-1, |
| 3270 | NULL,0,NULL,0); |
| 3271 | if (unzStringFileNameCompare(szCurrentFileName,szFileName,iCaseSensitivity)==0) |
| 3272 | return UNZ_OK; |
| 3273 | err = unzGoToNextFile(file); |
| 3274 | } |
| 3275 | |
| 3276 | s->num_file = num_fileSaved ; |
| 3277 | s->pos_in_central_dir = pos_in_central_dirSaved ; |
| 3278 | return err; |
| 3279 | } |
| 3280 | |
| 3281 | |
| 3282 | // Read the local header of the current zipfile |
no test coverage detected