MCPcopy Create free account
hub / github.com/Squirrel/Squirrel.Windows / unzLocateFile

Function unzLocateFile

src/Setup/unzip.cpp:3240–3279  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

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
3240int 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

Callers 1

FindMethod · 0.85

Calls 4

unzGoToFirstFileFunction · 0.85
unzGetCurrentFileInfoFunction · 0.85
unzStringFileNameCompareFunction · 0.85
unzGoToNextFileFunction · 0.85

Tested by

no test coverage detected