Modified system path defaults to utilize the User vs Res architecture. After reading some comments of the forum I realized I had implemented this all according to 0.16's design and not the new split architecture. All 'core_' zip files are now placed under 'Res' as before, but any other zip file will be put under the 'User' directory

This commit is contained in:
techdragon.nguyen@gmail.com
2012-01-02 05:32:22 +00:00
parent bf4e6b6884
commit 8f5ebc8109
4 changed files with 27 additions and 13 deletions

View File

@@ -39,7 +39,7 @@ static NSString *kDownloadFileName = @"core_017_iOS.zip";
}
// No longer needed.
- (void) unpackageResources
{
[self.downloadMessageStatus setText: @"Installing Game Resource Files"];
@@ -93,12 +93,16 @@ static NSString *kDownloadFileName = @"core_017_iOS.zip";
{
NSArray *paths = NSSearchPathForDirectoriesInDomains( NSDocumentDirectory,
NSUserDomainMask, YES);
NSString *userResourceDirectory = [[paths objectAtIndex:0] stringByAppendingString: @"/Res"];
NSString *downloadFilePath = [userResourceDirectory stringByAppendingString: [NSString stringWithFormat: @"/%@", kDownloadFileName]];
NSString *systemResourceDirectory = [[paths objectAtIndex:0] stringByAppendingString: @"/Res"];
NSString *userResourceDirectory = [[paths objectAtIndex: 0] stringByAppendingString: @"/User"];
NSString *downloadFilePath = [systemResourceDirectory stringByAppendingString: [NSString stringWithFormat: @"/%@", kDownloadFileName]];
NSError *error = nil;
// make sure Res directory exists
if ( ![[NSFileManager defaultManager] fileExistsAtPath: userResourceDirectory] )
[[NSFileManager defaultManager] createDirectoryAtPath:userResourceDirectory withIntermediateDirectories: YES attributes:nil error: &error];
if ( ![[NSFileManager defaultManager] fileExistsAtPath: systemResourceDirectory] )
[[NSFileManager defaultManager] createDirectoryAtPath:systemResourceDirectory withIntermediateDirectories: YES attributes:nil error: &error];
// make sure the User directory exists as well
if ( ![[NSFileManager defaultManager] fileExistsAtPath: userResourceDirectory] )
[[NSFileManager defaultManager] createDirectoryAtPath: userResourceDirectory withIntermediateDirectories: YES attributes:nil error: &error];
// if an error occurred while creating the directory, game can't really run so do something
// TODO: throw out a notification and deal with error
@@ -123,7 +127,7 @@ static NSString *kDownloadFileName = @"core_017_iOS.zip";
[request setAllowCompressedResponse: YES];
[request setCompletionBlock:^{
[self unpackageResources];
// [self unpackageResources];
wagicAppDelegate *appDelegate = (wagicAppDelegate *)[[UIApplication sharedApplication] delegate];
NSNotificationCenter *dnc = [NSNotificationCenter defaultCenter];
[dnc postNotificationName:@"readyToStartGame" object: appDelegate];

View File

@@ -2464,6 +2464,7 @@
"$(ARCHS_STANDARD_32_BIT)",
);
CODE_SIGN_IDENTITY = "iPhone Distribution";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
COPY_PHASE_STRIP = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = wagic_Prefix.pch;
@@ -2494,6 +2495,7 @@
);
PRODUCT_NAME = "wagic copy";
PROVISIONING_PROFILE = "";
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "";
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
};