37 :(NSString*)path
38{
39 NSUInteger i, cl;
40 NSArray* components = [path pathComponents];
41 cl = [components count];
42 for (i = 0; i < cl; i++) {
43 NSString* component = [components objectAtIndex:i];
44 if ([[[component pathExtension] lowercaseString] isEqualToString:@"oxz"]) {
45 break;
46 }
47 }
48
49 if (i == cl) {
50
51
52#if OOLITE_MAC_OS_X
53 return [[[NSData alloc] initWithContentsOfMappedFile:path] autorelease];
54#else
55 NSFileManager* fmgr = [NSFileManager defaultManager];
56 BOOL dir;
57
58 if ([fmgr fileExistsAtPath:path isDirectory:&dir]) {
59 if (!dir) {
60 if ([[fmgr fileAttributesAtPath:path traverseLink:NO] fileSize] == 0) {
62 } else {
63 return [[[NSData alloc] initWithContentsOfMappedFile:path] autorelease];
64 }
65 } else {
67 }
68 }
70#endif
71 }
72
73
74 NSRange range;
75 range.location = 0;
76 range.length = i + 1;
77 NSString* zipFile = [NSString pathWithComponents:[components subarrayWithRange:range]];
78 range.location = i + 1;
79 range.length = cl - (i + 1);
80 NSString* containedFile = [NSString pathWithComponents:[components subarrayWithRange:range]];
81
83 const char* zipname = [zipFile UTF8String];
84 if (zipname != NULL) {
86 }
87 if (uf == NULL) {
88
89
90
92 }
93 const char*
filename = [containedFile UTF8String];
94
97
98
99
100
101
103 }
104
112 }
113
119 }
120
121 NSMutableData* tmp = [NSMutableData dataWithCapacity:file_info.uncompressed_size];
123 do {
125 if (err < 0) {
127 break;
128 }
129 if (err == 0) {
130 break;
131 }
132 [tmp appendBytes:buf length:err];
133 } while (err > 0);
135
141 }
142
144 return [[tmp retain] autorelease];
145}
#define OOLog(class, format,...)
NSString *const kOOLogFileNotFound
int ZEXPORT unzLocateFile(unzFile file, const char *szFileName, int iCaseSensitivity)
int ZEXPORT unzGetCurrentFileInfo64(unzFile file, unz_file_info64 *pfile_info, char *szFileName, uLong fileNameBufferSize, void *extraField, uLong extraFieldBufferSize, char *szComment, uLong commentBufferSize)
int ZEXPORT unzOpenCurrentFile(unzFile file)
int ZEXPORT unzReadCurrentFile(unzFile file, voidp buf, unsigned len)
unzFile ZEXPORT unzOpen64(const void *path)
int ZEXPORT unzCloseCurrentFile(unzFile file)
int ZEXPORT unzClose(unzFile file)
struct unz_file_info64_s unz_file_info64