D.M Patel
D.M Patel

Reputation: 145

how to get number of unzipped files while using Unzip class?

I have used ZipArchive class to get unzipped files.I want to display number of unzipped files during the operation of unzipping.can anybody guide me or show me some way to do it?

Upvotes: 0

Views: 112

Answers (1)

Joachim Isaksson
Joachim Isaksson

Reputation: 180927

I don't know of a way to get it "by default", but in ZipArchive.mm, you have this code to open a zip archive;

-(BOOL) UnzipOpenFile:(NSString*) zipFile
{
    _unzFile = unzOpen( (const char*)[zipFile UTF8String] );
    if( _unzFile )
    {
        unz_global_info  globalInfo = {0};
        if( unzGetGlobalInfo(_unzFile, &globalInfo )==UNZ_OK )
        {
            NSLog([NSString stringWithFormat:@"%d entries in the zip file",
                 globalInfo.number_entry] );
        }
    }
    return _unzFile!=NULL;
}

It logs the number of files in the zip, so an easy way would be to create a property on the ZipArchive class and save the value to that for later reading.

Upvotes: 1

Related Questions