︙ | | |
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
|
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
|
-
-
+
+
|
{
void *pool = objc_autoreleasePoolPush();
OFString *ret, *fileName;
size_t pos;
fileName = self.lastPathComponent;
pos = [fileName rangeOfString: @"."
options: OF_STRING_SEARCH_BACKWARDS].location;
if (pos == OF_NOT_FOUND || pos == 0) {
options: OFStringSearchBackwards].location;
if (pos == OFNotFound || pos == 0) {
objc_autoreleasePoolPop(pool);
return @"";
}
ret = [fileName substringFromIndex: pos + 1];
[ret retain];
|
︙ | | |
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
|
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
|
-
+
|
}
objc_autoreleasePoolPop(pool);
return @".";
}
components = [components objectsInRange:
of_range(0, components.count - 1)];
OFMakeRange(0, components.count - 1)];
ret = [OFString pathWithComponents: components];
[ret retain];
objc_autoreleasePoolPop(pool);
return [ret autorelease];
}
|
︙ | | |
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
|
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
|
-
-
+
+
|
return [[self copy] autorelease];
pool = objc_autoreleasePoolPush();
components = [[self.pathComponents mutableCopy] autorelease];
fileName = components.lastObject;
pos = [fileName rangeOfString: @"."
options: OF_STRING_SEARCH_BACKWARDS].location;
if (pos == OF_NOT_FOUND || pos == 0) {
options: OFStringSearchBackwards].location;
if (pos == OFNotFound || pos == 0) {
objc_autoreleasePoolPop(pool);
return [[self copy] autorelease];
}
fileName = [fileName substringToIndex: pos];
[components replaceObjectAtIndex: components.count - 1
withObject: fileName];
|
︙ | | |
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
|
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
|
-
+
|
if ([component isEqual: @".."] && parent != nil &&
![parent isEqual: @".."] &&
![parent hasSuffix: @":"] &&
![parent hasSuffix: @":\\"] &&
![parent hasSuffix: @"://"] &&
(![parent hasPrefix: @"\\"] || i != 1)) {
[array removeObjectsInRange:
of_range(i - 1, 2)];
OFMakeRange(i - 1, 2)];
done = false;
break;
}
}
}
|
︙ | | |
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
|
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
|
-
+
|
if (components.count < 2)
@throw [OFInvalidFormatException exception];
*URLEncodedHost = [[components objectAtIndex: 1]
stringByURLEncodingWithAllowedCharacters:
[OFCharacterSet URLHostAllowedCharacterSet]];
path = [OFString pathWithComponents: [components
objectsInRange: of_range(2, components.count - 2)]];
objectsInRange: OFMakeRange(2, components.count - 2)]];
}
path = [path stringByReplacingOccurrencesOfString: @"\\"
withString: @"/"];
path = [path stringByPrependingString: @"/"];
return path;
|
︙ | | |