From c55632a19b2d8a46c8da1b56c51b7fb2bc298195 Mon Sep 17 00:00:00 2001 From: "techdragon.nguyen@gmail.com" Date: Wed, 22 Feb 2012 08:37:43 +0000 Subject: [PATCH] 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. --- JGE/src/iOS/wagicAppDelegate.m | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/JGE/src/iOS/wagicAppDelegate.m b/JGE/src/iOS/wagicAppDelegate.m index 6b6a6b90b..2c3c813ea 100755 --- a/JGE/src/iOS/wagicAppDelegate.m +++ b/JGE/src/iOS/wagicAppDelegate.m @@ -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);