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 {
44 NSString *component = [components objectAtIndex:i];
45 if ([[[component pathExtension] lowercaseString] isEqualToString:@"oxz"])
46 {
47 break;
48 }
49 }
50
51 if (i == cl)
52 {
53
54
55#if OOLITE_MAC_OS_X
56 return [[[NSData alloc] initWithContentsOfMappedFile:path] autorelease];
57#else
58 NSFileManager *fmgr = [NSFileManager defaultManager];
59 BOOL dir;
60
61 if ([fmgr fileExistsAtPath:path isDirectory:&dir])
62 {
63 if (!dir)
64 {
65 if ([[fmgr fileAttributesAtPath:path traverseLink:NO] fileSize] == 0)
66 {
68 }
69 else
70 {
71 return [[[NSData alloc] initWithContentsOfMappedFile:path] autorelease];
72 }
73 }
74 else
75 {
77 }
78 }
80#endif
81 }
82
83
84 NSRange range;
85 range.location = 0; range.length = i+1;
86 NSString *zipFile = [NSString pathWithComponents:[components subarrayWithRange:range]];
87 range.location = i+1; range.length = cl-(i+1);
88 NSString *containedFile = [NSString pathWithComponents:[components subarrayWithRange:range]];
89
91 const char* zipname = [zipFile UTF8String];
92 if (zipname != NULL)
93 {
95 }
96 if (uf == NULL)
97 {
98
99
100
102 }
103 const char*
filename = [containedFile UTF8String];
104
106 {
108
109
110
111
112
114 }
115
120 {
124 }
125
128 {
132 }
133
134
135
136 NSMutableData *tmp = [NSMutableData dataWithCapacity:file_info.uncompressed_size];
138 do
139 {
141 if (err < 0)
142 {
144 break;
145 }
146 if (err == 0)
147 {
148 break;
149 }
150 [tmp appendBytes:buf length:err];
151 }
152 while (err > 0);
154
157 {
161 }
162
164 return [[tmp retain] autorelease];
165
166}
#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)