Differences From Artifact [7016e3a6f1]:
- File
src/OFURL.m
— part of check-in
[b83d1414b1]
at
2017-10-29 00:41:52
on branch trunk
— Fix conversion between URL and path on Win32
This also adds -[OFURL fileSystemRepresentation] to correctly convert a
URL back to a path in the local file system. (user: js, size: 11176) [annotate] [blame] [check-ins using]
To Artifact [47b11362db]:
- File src/OFURL.m — part of check-in [773997d072] at 2017-10-29 11:25:05 on branch trunk — Add +[OFURL fileURLWithPath:isDirectory:] (user: js, size: 11983) [annotate] [blame] [check-ins using]
︙ | |||
50 51 52 53 54 55 56 | 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | - + - - - + - - - - - - - - + + - - - - + - - - + + | return [[[self alloc] initWithString: string relativeToURL: URL] autorelease]; } #ifdef OF_HAVE_FILES + (instancetype)fileURLWithPath: (OFString *)path { |
︙ | |||
278 279 280 281 282 283 284 285 286 287 288 289 290 291 | 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | @throw e; } @finally { free(UTF8String2); } return self; } #ifdef OF_HAVE_FILES - (instancetype)initFileURLWithPath: (OFString *)path { @try { void *pool = objc_autoreleasePoolPush(); OFFileManager *fileManager = [OFFileManager defaultManager]; bool isDirectory; isDirectory = ([path hasSuffix: OF_PATH_DELIMITER_STRING] || [fileManager directoryExistsAtPath: path]); self = [self initFileURLWithPath: path isDirectory: isDirectory]; objc_autoreleasePoolPop(pool); } @catch (id e) { [self release]; @throw e; } return self; } - (instancetype)initFileURLWithPath: (OFString *)path isDirectory: (bool)isDirectory { @try { void *pool = objc_autoreleasePoolPush(); OFURL *currentDirectoryURL; # if OF_PATH_DELIMITER != '/' path = [[path pathComponents] componentsJoinedByString: @"/"]; # endif if (isDirectory && ![path hasSuffix: OF_PATH_DELIMITER_STRING]) path = [path stringByAppendingString: @"/"]; currentDirectoryURL = [[OFFileManager defaultManager] currentDirectoryURL]; self = [self initWithString: path relativeToURL: currentDirectoryURL]; objc_autoreleasePoolPop(pool); } @catch (id e) { [self release]; @throw e; } return self; } #endif - (instancetype)initWithSerialization: (OFXMLElement *)element { @try { void *pool = objc_autoreleasePoolPush(); if (![[element name] isEqual: [self className]] || |
︙ |