7 Commits

Author SHA1 Message Date
Joshua Hudson
66ab1372d8 Remove warnings from the 2.0 release 2017-07-19 12:33:46 -07:00
Joshua Hudson
b64a644f04 Update README.md 2017-07-17 17:49:44 -07:00
Joshua Hudson
ddd032f71f Update README.md 2017-07-17 17:49:27 -07:00
Joshua Hudson
5bb24be26b Update README.md 2017-07-17 09:07:11 -07:00
Joshua Hudson
6fc5255676 Merge pull request #345 from june20com/master
Added support for overwriting existing symlinks
2017-07-17 09:04:50 -07:00
Joshua Hudson
775a246b2b Update README.md 2017-07-17 08:59:15 -07:00
Paulo Fierro
1ff099811e Added support for overwriting existing symlinks
Also added errors if these operations fail.
2017-06-22 12:57:32 -05:00
5 changed files with 34 additions and 9 deletions

View File

@@ -1,5 +1,5 @@
PODS:
- SSZipArchive (2.0.0)
- SSZipArchive (2.0.1)
DEPENDENCIES:
- SSZipArchive (from `..`)
@@ -9,7 +9,7 @@ EXTERNAL SOURCES:
:path: ".."
SPEC CHECKSUMS:
SSZipArchive: 8153333145bf99acaf1918d257fdcef68a9269e1
SSZipArchive: 6678776f378494909195d3f1b3f00d91e76084f9
PODFILE CHECKSUM: 7f4058a9cbc69b4e63808729577a8bb2098bc527

View File

@@ -14,7 +14,7 @@ ZipArchive is a simple utility class for zipping and unzipping files on iOS and
## Installation and Setup
*The main release branch is configured to support Objective C and Swift 3. There is a 'swift23' branch which is the latest branch but marked to compile for Swift 2.3.*
*The main release branch is configured to support Objective C and Swift 3. There is a 'swift23' branch which is a tied to a older 1.x release and will not be upgraded. Xcode 8.3+ removes support for Swift 2.3*
### CocoaPods

View File

@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'SSZipArchive'
s.version = '2.0.0'
s.version = '2.0.1'
s.summary = 'Utility class for zipping and unzipping files on iOS, tvOS, watchOS, and Mac.'
s.description = 'SSZipArchive is a simple utility class for zipping and unzipping files on iOS, tvOS, watchOS, and Mac.'
s.homepage = 'https://github.com/ZipArchive/ZipArchive'

View File

@@ -465,13 +465,34 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
[destinationPath appendString:@((const char*)buffer)];
}
// Check if the symlink exists and delete it if we're overwriting
if (overwrite)
{
if ([fileManager fileExistsAtPath:fullPath])
{
NSError *error = nil;
BOOL success = [fileManager removeItemAtPath:fullPath error:&error];
if (!success)
{
NSString *message = [NSString stringWithFormat:@"Failed to delete existing symbolic link at \"%@\"", error.localizedDescription];
NSLog(@"[SSZipArchive] %@", message);
success = NO;
unzippingError = [NSError errorWithDomain:SSZipArchiveErrorDomain code:error.code userInfo:@{NSLocalizedDescriptionKey: message}];
}
}
}
// Create the symbolic link (making sure it stays relative if it was relative before)
int symlinkError = symlink([destinationPath cStringUsingEncoding:NSUTF8StringEncoding],
[fullPath cStringUsingEncoding:NSUTF8StringEncoding]);
if (symlinkError != 0)
{
NSLog(@"Failed to create symbolic link at \"%@\" to \"%@\". symlink() error code: %d", fullPath, destinationPath, errno);
// Bubble the error up to the completion handler
NSString *message = [NSString stringWithFormat:@"Failed to create symbolic link at \"%@\" to \"%@\" - symlink() error code: %d", fullPath, destinationPath, errno];
NSLog(@"[SSZipArchive] %@", message);
success = NO;
unzippingError = [NSError errorWithDomain:NSPOSIXErrorDomain code:symlinkError userInfo:@{NSLocalizedDescriptionKey: message}];
}
}
@@ -729,7 +750,9 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
uLong permissionsLong = @(permissionsOctal).unsignedLongValue;
// Store this into the external file attributes once it has been shifted 16 places left to form part of the second from last byte
zipInfo.external_fa = permissionsLong << 16L;
//Casted back to an unsigned int to match type of external_fa in minizip
zipInfo.external_fa = (unsigned int)(permissionsLong << 16L);
}
}
@@ -791,7 +814,9 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
uLong permissionsLong = @(permissionsOctal).unsignedLongValue;
// Store this into the external file attributes once it has been shifted 16 places left to form part of the second from last byte
zipInfo.external_fa = permissionsLong << 16L;
//Casted back to an unsigned int to match type of external_fa in minizip
zipInfo.external_fa = (unsigned int)(permissionsLong << 16L);
}
}

View File

@@ -1,5 +1,5 @@
PODS:
- SSZipArchive (2.0.0)
- SSZipArchive (2.0.1)
DEPENDENCIES:
- SSZipArchive (from `..`)
@@ -9,7 +9,7 @@ EXTERNAL SOURCES:
:path: ".."
SPEC CHECKSUMS:
SSZipArchive: 8153333145bf99acaf1918d257fdcef68a9269e1
SSZipArchive: 6678776f378494909195d3f1b3f00d91e76084f9
PODFILE CHECKSUM: 0dc500eb72745751ccba7677de4da5534fcef36d