Alex1987
Alex1987

Reputation: 9457

Is there an unrar library out there for iOS?

I want to include an unrar files option in my iphone app.

I have already tried https://github.com/ararog/Unrar4iOS but this library is not complete (some functions are not yet implemented like -(BOOL) unrarFileTo:(NSString*)path overWrite:(BOOL)overwrite)

Thanks.

Upvotes: 7

Views: 3571

Answers (3)

Alex1987
Alex1987

Reputation: 9457

I ended up using Unrar4ios but I needed to write myself the function that actually extracts the rar file:

-(BOOL) unrarFileTo:(NSString*)path overWrite:(BOOL)overwrite {

    int RHCode = 0, PFCode = 0;

    [self _unrarOpenFile:filename mode:RAR_OM_EXTRACT];

    while ((RHCode = RARReadHeaderEx(_rarFile, header)) == 0) {

        if ((PFCode = RARProcessFile(_rarFile, RAR_EXTRACT, (char *)[path UTF8String], NULL)) != 0) {
            [self _unrarCloseFile];
            return NO;
        }

    }

    [self _unrarCloseFile];


    return YES;
}

Upvotes: 5

MindJuice
MindJuice

Reputation: 4291

The unrarlib library should work for you, since Objective C is a superset of C.

Upvotes: 0

omz
omz

Reputation: 53561

This might help: https://github.com/ararog/Unrar4iOS

Upvotes: 4

Related Questions