allowed for overwriting of existing zip files. The existing file needs to be removed before copying new file to existing location. Otherwise an exception is flagged and nothing is done.

This commit is contained in:
techdragon.nguyen@gmail.com
2012-02-22 08:37:43 +00:00
parent f9a7317904
commit c55632a19b

View File

@@ -149,6 +149,12 @@
{
NSString *oldPath = [NSString stringWithFormat: @"%@/%@", docsPath, zipFile];
NSString *newPath = [NSString stringWithFormat: @"%@/%@", userPath, zipFile];
if ( [fileManager fileExistsAtPath: newPath] )
{
NSLog(@"Removing old file at %@", newPath);
[fileManager removeItemAtPath: newPath error: &error];
}
error = nil;
[fileManager moveItemAtPath: oldPath toPath:newPath error: &error];
NSLog(@"Moving %@ to %@", oldPath, newPath);
@@ -163,6 +169,12 @@
{
NSString *oldPath = [NSString stringWithFormat: @"%@/%@", docsPath, zipFile];
NSString *newPath = [NSString stringWithFormat: @"%@/%@", resPath, zipFile];
if ( [fileManager fileExistsAtPath: newPath] )
{
NSLog(@"Removing old file at %@", newPath);
[fileManager removeItemAtPath: newPath error: &error];
}
error = nil;
[fileManager moveItemAtPath: oldPath toPath:newPath error: &error];
NSLog(@"Moving %@ to %@", oldPath, newPath);