Differences From Artifact [6274573b21]:
- File
src/OFURL.m
— part of check-in
[0f995db06d]
at
2017-10-28 21:08:37
on branch trunk
— Make OFURL more generic
This removes the special handling dependent on the scheme. (user: js, size: 10005) [annotate] [blame] [check-ins using]
To Artifact [5a68687d28]:
- File src/OFURL.m — part of check-in [8aa7f964bc] at 2017-10-28 23:52:32 on branch trunk — OFURL: Return a proper URL for +[fileURLWithPath:] (user: js, size: 10458) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
18 19 20 21 22 23 24 25 26 27 28 29 30 31 | #include <stdlib.h> #include <string.h> #import "OFURL.h" #import "OFURL+Private.h" #import "OFArray.h" #import "OFNumber.h" #import "OFString.h" #import "OFXMLElement.h" #import "OFInvalidArgumentException.h" #import "OFInvalidFormatException.h" #import "OFOutOfMemoryException.h" | > > > | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | #include <stdlib.h> #include <string.h> #import "OFURL.h" #import "OFURL+Private.h" #import "OFArray.h" #ifdef OF_HAVE_FILES # import "OFFileManager.h" #endif #import "OFNumber.h" #import "OFString.h" #import "OFXMLElement.h" #import "OFInvalidArgumentException.h" #import "OFInvalidFormatException.h" #import "OFOutOfMemoryException.h" |
︙ | ︙ | |||
44 45 46 47 48 49 50 51 52 | + (instancetype)URLWithString: (OFString *)string relativeToURL: (OFURL *)URL { return [[[self alloc] initWithString: string relativeToURL: URL] autorelease]; } + (instancetype)fileURLWithPath: (OFString *)path { | > < > > > > > | > | > | > > > | > | 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | + (instancetype)URLWithString: (OFString *)string relativeToURL: (OFURL *)URL { return [[[self alloc] initWithString: string relativeToURL: URL] autorelease]; } #ifdef OF_HAVE_FILES + (instancetype)fileURLWithPath: (OFString *)path { void *pool = objc_autoreleasePoolPush(); OFFileManager *fileManager = [OFFileManager defaultManager]; OFURL *currentDirectoryURL, *URL; if (![path hasSuffix: OF_PATH_DELIMITER_STRING] && [fileManager directoryExistsAtPath: path]) path = [path stringByAppendingString: @"/"]; # if OF_PATH_DELIMITER != '/' path = [[path pathComponents] componentsJoinedByString: @"/"]; # endif currentDirectoryURL = [[OFFileManager defaultManager] currentDirectoryURL]; URL = [[OFURL alloc] initWithString: path relativeToURL: currentDirectoryURL]; objc_autoreleasePoolPop(pool); return [URL autorelease]; } #endif - (instancetype)init { OF_INVALID_INIT_METHOD } - (instancetype)of_init |
︙ | ︙ |