This commit is contained in:
Sam Soffes
2010-08-19 15:27:48 -05:00
parent f56f20f4e4
commit e4fd78a88d
4 changed files with 17 additions and 17 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
Copyright (c) 2010 Tasteful Works, Inc.
Copyright (c) 2010 Sam Soffes
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
+4 -4
View File
@@ -1,16 +1,16 @@
# TWZipArchive
# SSZipArchive
TWZipArchive is a simple utility class for unzipping files based on [ZipArchive](http://code.google.com/p/ziparchive).
SSZipArchive is a simple utility class for unzipping files based on [ZipArchive](http://code.google.com/p/ziparchive).
Currently it only supports unzipping. In the future, creating zip files will be supported.
## Adding to your project
1. Add `TWZipArchive.h`, `TWZipArchive.m`, and `minizip` to your project.
1. Add `SSZipArchive.h`, `SSZipArchive.m`, and `minizip` to your project.
2. Add the `libz` library to your target
## Usage
NSString *path = @"path_to_your_zip_file";
NSString *destination = @"path_to_the_folder_where_you_want_it_unzipped";
[TWZipArchive unzipFileAtPath:path toDestination:destination];
[SSZipArchive unzipFileAtPath:path toDestination:destination];
+4 -4
View File
@@ -1,15 +1,15 @@
//
// TWZipArchive.h
// TWZipArchive
// SSZipArchive.h
// SSZipArchive
//
// Created by Sam Soffes on 7/21/10.
// Copyright Tasteful Works 2010. All rights reserved.
// Copyright Sam Soffes 2010. All rights reserved.
//
// Based on ZipArchive by aish
// http://code.google.com/p/ziparchive
//
@interface TWZipArchive : NSObject {
@interface SSZipArchive : NSObject {
}
+8 -8
View File
@@ -1,23 +1,23 @@
//
// TWZipArchive.mm
// TWZipArchive
// SSZipArchive.m
// SSZipArchive
//
// Created by Sam Soffes on 7/21/10.
// Copyright Tasteful Works 2010. All rights reserved.
// Copyright Sam Soffes 2010. All rights reserved.
//
#import "TWZipArchive.h"
#import "SSZipArchive.h"
#include "minizip/zip.h"
#include "minizip/unzip.h"
#import "zlib.h"
#import "zconf.h"
@interface TWZipArchive (PrivateMethods)
@interface SSZipArchive (PrivateMethods)
+ (NSDate *)_dateFor1980;
@end
@implementation TWZipArchive
@implementation SSZipArchive
+ (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination {
return [self unzipFileAtPath:path toDestination:destination overwrite:YES password:nil error:nil];
@@ -29,7 +29,7 @@
if (zip == NULL) {
NSDictionary *userInfo = [NSDictionary dictionaryWithObject:@"failed to open zip file" forKey:NSLocalizedDescriptionKey];
if (error) {
*error = [NSError errorWithDomain:@"TWZipArchiveErrorDomain" code:-1 userInfo:userInfo];
*error = [NSError errorWithDomain:@"SSZipArchiveErrorDomain" code:-1 userInfo:userInfo];
}
return NO;
}
@@ -41,7 +41,7 @@
if (unzGoToFirstFile(zip) != UNZ_OK) {
NSDictionary *userInfo = [NSDictionary dictionaryWithObject:@"failed to open first file in zip file" forKey:NSLocalizedDescriptionKey];
if (error) {
*error = [NSError errorWithDomain:@"TWZipArchiveErrorDomain" code:-2 userInfo:userInfo];
*error = [NSError errorWithDomain:@"SSZipArchiveErrorDomain" code:-2 userInfo:userInfo];
}
return NO;
}