Index: generators/library/LibraryGenerator.m ================================================================== --- generators/library/LibraryGenerator.m +++ generators/library/LibraryGenerator.m @@ -44,20 +44,24 @@ OFURL *runtimeGlueURL = [sourcesURL URLByAppendingPathComponent: @"runtime/amiga-glue.m"]; OFURL *runtimeFuncArrayURL = [sourcesURL URLByAppendingPathComponent: @"runtime/amiga-funcarray.inc"]; OFXMLElement *runtimeLibrary = [OFXMLElement elementWithStream: - [OFFile fileWithURL: runtimeLibraryURL - mode: @"r"]]; - OFFile *runtimeLinkLib = [OFFile fileWithURL: runtimeLinkLibURL - mode: @"w"]; - OFFile *runtimeGlueHeader = [OFFile fileWithURL: runtimeGlueHeaderURL - mode: @"w"]; - OFFile *runtimeGlue = [OFFile fileWithURL: runtimeGlueURL - mode: @"w"]; - OFFile *runtimeFuncArray = [OFFile fileWithURL: runtimeFuncArrayURL - mode: @"w"]; + [OFFile fileWithPath: runtimeLibraryURL.fileSystemRepresentation + mode: @"r"]]; + OFFile *runtimeLinkLib = + [OFFile fileWithPath: runtimeLinkLibURL.fileSystemRepresentation + mode: @"w"]; + OFFile *runtimeGlueHeader = + [OFFile fileWithPath: runtimeGlueHeaderURL.fileSystemRepresentation + mode: @"w"]; + OFFile *runtimeGlue = + [OFFile fileWithPath: runtimeGlueURL.fileSystemRepresentation + mode: @"w"]; + OFFile *runtimeFuncArray = + [OFFile fileWithPath: runtimeFuncArrayURL.fileSystemRepresentation + mode: @"w"]; LinkLibGenerator *runtimeLinkLibGenerator = [[[LinkLibGenerator alloc] initWithLibrary: runtimeLibrary implementation: runtimeLinkLib] autorelease]; GlueGenerator *runtimeGlueGenerator = [[[GlueGenerator alloc] initWithLibrary: runtimeLibrary Index: src/OFFile.h ================================================================== --- src/OFFile.h +++ src/OFFile.h @@ -63,30 +63,10 @@ * `a+` | Read-write, create or append * @return A new autoreleased OFFile */ + (instancetype)fileWithPath: (OFString *)path mode: (OFString *)mode; -/** - * @brief Creates a new OFFile with the specified URL and mode. - * - * @param URL The URL to the file to open - * @param mode The mode in which the file should be opened.@n - * Possible modes are: - * Mode | Description - * ---------------|------------------------------------- - * `r` | Read-only - * `r+` | Read-write - * `w` | Write-only, create or truncate - * `wx` | Write-only, create or fail, exclusive - * `w+` | Read-write, create or truncate - * `w+x` | Read-write, create or fail, exclusive - * `a` | Write-only, create or append - * `a+` | Read-write, create or append - * @return A new autoreleased OFFile - */ -+ (instancetype)fileWithURL: (OFURL *)URL mode: (OFString *)mode; - /** * @brief Creates a new OFFile with the specified native file handle. * * @param handle A native file handle. If OF_FILE_HANDLE_IS_FD is defined, this * is a file descriptor. The handle is closed when the OFFile @@ -93,12 +73,10 @@ * object is deallocated! * @return A new autoreleased OFFile */ + (instancetype)fileWithHandle: (OFFileHandle)handle; -- (instancetype)init OF_UNAVAILABLE; - /** * @brief Initializes an already allocated OFFile. * * @param path The path to the file to open as a string * @param mode The mode in which the file should be opened.@n @@ -122,38 +100,16 @@ - (instancetype)initWithPath: (OFString *)path mode: (OFString *)mode; /** * @brief Initializes an already allocated OFFile. * - * @param URL The URL to the file to open - * @param mode The mode in which the file should be opened.@n - * Possible modes are: - * Mode | Description - * ---------------|------------------------------------- - * `r` | read-only - * `rb` | read-only, binary - * `r+` | read-write - * `rb+` or `r+b` | read-write, binary - * `w` | write-only, create, truncate - * `wb` | write-only, create, truncate, binary - * `w` | read-write, create, truncate - * `wb+` or `w+b` | read-write, create, truncate, binary - * `a` | write-only, create, append - * `ab` | write-only, create, append, binary - * `a+` | read-write, create, append - * `ab+` or `a+b` | read-write, create, append, binary - * @return An initialized OFFile - */ -- (instancetype)initWithURL: (OFURL *)URL mode: (OFString *)mode; - -/** - * @brief Initializes an already allocated OFFile. - * * @param handle A native file handle. If OF_FILE_HANDLE_IS_FD is defined, this * is a file descriptor. The handle is closed when the OFFile * object is deallocated! * @return An initialized OFFile */ - (instancetype)initWithHandle: (OFFileHandle)handle OF_DESIGNATED_INITIALIZER; + +- (instancetype)init OF_UNAVAILABLE; @end OF_ASSUME_NONNULL_END Index: src/OFFile.m ================================================================== --- src/OFFile.m +++ src/OFFile.m @@ -189,25 +189,15 @@ + (instancetype)fileWithPath: (OFString *)path mode: (OFString *)mode { return [[[self alloc] initWithPath: path mode: mode] autorelease]; } -+ (instancetype)fileWithURL: (OFURL *)URL mode: (OFString *)mode -{ - return [[[self alloc] initWithURL: URL mode: mode] autorelease]; -} - + (instancetype)fileWithHandle: (OFFileHandle)handle { return [[[self alloc] initWithHandle: handle] autorelease]; } -- (instancetype)init -{ - OF_INVALID_INIT_METHOD -} - - (instancetype)initWithPath: (OFString *)path mode: (OFString *)mode { OFFileHandle handle; @try { @@ -327,37 +317,23 @@ } return self; } -- (instancetype)initWithURL: (OFURL *)URL mode: (OFString *)mode -{ - void *pool = objc_autoreleasePoolPush(); - OFString *fileSystemRepresentation; - - @try { - fileSystemRepresentation = URL.fileSystemRepresentation; - } @catch (id e) { - [self release]; - @throw e; - } - - self = [self initWithPath: fileSystemRepresentation mode: mode]; - - objc_autoreleasePoolPop(pool); - - return self; -} - - (instancetype)initWithHandle: (OFFileHandle)handle { self = [super init]; _handle = handle; return self; } + +- (instancetype)init +{ + OF_INVALID_INIT_METHOD +} - (bool)lowlevelIsAtEndOfStream { if (_handle == OFInvalidFileHandle) @throw [OFNotOpenException exceptionWithObject: self];