Skip to content

Commit e1d9e68

Browse files
author
Johannes Ekberg
committed
fixed Compressed Resource Loading!
1 parent f385d5e commit e1d9e68

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

Model/Novel.m

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,13 @@ - (NSData *)contentsOfResource:(NSString *)res inDirectory:(NSString *)dir
101101
NSString *dirPath = [path stringByAppendingPathComponent:dir];
102102

103103
//Attempt to load from a Zip File first
104-
unzFile zipFile = unzOpen([dirPath UTF8String]);
104+
MTLog(@"Zip Path: %@", [dirPath stringByAppendingPathExtension:@"zip"]);
105+
unzFile zipFile = unzOpen([[dirPath stringByAppendingPathExtension:@"zip"] UTF8String]);
105106
if(zipFile != NULL)
106107
{
107108
MTLog(@"Reading from Zip...");
108-
if(unzLocateFile(zipFile, [res UTF8String], 0) == UNZ_OK)
109+
if(unzLocateFile(zipFile, [res UTF8String], 0) == UNZ_OK ||
110+
unzLocateFile(zipFile, [[dir stringByAppendingPathComponent:res] UTF8String], 0) == UNZ_OK)
109111
{
110112
if(unzOpenCurrentFile(zipFile) == UNZ_OK)
111113
{
@@ -126,7 +128,7 @@ - (NSData *)contentsOfResource:(NSString *)res inDirectory:(NSString *)dir
126128
} else MTLog(@"ERROR: Couldn't open Current File");
127129

128130
unzClose(zipFile);
129-
} else MTLog(@"ERROR: Couldn't locate file");
131+
} else MTLog(@"ERROR: Couldn't locate file '%@'", res);
130132
}
131133
else
132134
{

0 commit comments

Comments
 (0)