Index: ObjFW.xcodeproj/project.pbxproj ================================================================== --- ObjFW.xcodeproj/project.pbxproj +++ ObjFW.xcodeproj/project.pbxproj @@ -260,14 +260,10 @@ 4B55A113133AC24600B58A93 /* OFReadFailedException.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B55A10D133AC24500B58A93 /* OFReadFailedException.m */; }; 4B55A114133AC24600B58A93 /* OFReadOrWriteFailedException.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B55A10E133AC24500B58A93 /* OFReadOrWriteFailedException.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4B55A115133AC24600B58A93 /* OFReadOrWriteFailedException.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B55A10F133AC24500B58A93 /* OFReadOrWriteFailedException.m */; }; 4B55A116133AC24600B58A93 /* OFWriteFailedException.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B55A110133AC24500B58A93 /* OFWriteFailedException.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4B55A117133AC24600B58A93 /* OFWriteFailedException.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B55A111133AC24600B58A93 /* OFWriteFailedException.m */; }; - 4B55ADF3177BAE290013D88E /* OFRemoveFailedException.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B55ADEF177BAE290013D88E /* OFRemoveFailedException.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 4B55ADF4177BAE290013D88E /* OFRemoveFailedException.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B55ADF0177BAE290013D88E /* OFRemoveFailedException.m */; }; - 4B55ADF5177BAE290013D88E /* OFRenameFailedException.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B55ADF1177BAE290013D88E /* OFRenameFailedException.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 4B55ADF6177BAE290013D88E /* OFRenameFailedException.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B55ADF2177BAE290013D88E /* OFRenameFailedException.m */; }; 4B5CF8F914940BD2007AA324 /* OFString+JSONValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B5CF8F614940BD2007AA324 /* OFString+JSONValue.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4B5CF8FA14940BD2007AA324 /* OFString+JSONValue.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B5CF8F714940BD2007AA324 /* OFString+JSONValue.m */; }; 4B64D6EF1425381E007BDFB1 /* OFStreamObserver_poll.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B64D6EB1425381E007BDFB1 /* OFStreamObserver_poll.h */; }; 4B64D6F01425381E007BDFB1 /* OFStreamObserver_poll.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B64D6EC1425381E007BDFB1 /* OFStreamObserver_poll.m */; }; 4B64D6F11425381E007BDFB1 /* OFStreamObserver_select.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B64D6ED1425381E007BDFB1 /* OFStreamObserver_select.h */; }; @@ -391,10 +387,14 @@ 4BF33B12133807A20059CEF7 /* TestsAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B6EF6811235358D0076B512 /* TestsAppDelegate.m */; }; 4BF33B4713380CE20059CEF7 /* testfile.txt in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4BF33B4313380CD40059CEF7 /* testfile.txt */; }; 4BF33B4813380D2D0059CEF7 /* testfile.bin in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4BF33B4213380CD40059CEF7 /* testfile.bin */; }; 4BFDB4D2168B93CB006A4027 /* OFHTTPRequestReply.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BFDB4CF168B939A006A4027 /* OFHTTPRequestReply.m */; }; 4BFDB4D3168B93F9006A4027 /* OFHTTPRequestReply.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BFDB4CE168B939A006A4027 /* OFHTTPRequestReply.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 4BFF3714177E17C100192782 /* OFRemoveItemFailedException.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BFF3710177E17C100192782 /* OFRemoveItemFailedException.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 4BFF3715177E17C100192782 /* OFRemoveItemFailedException.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BFF3711177E17C100192782 /* OFRemoveItemFailedException.m */; }; + 4BFF3716177E17C100192782 /* OFRenameItemFailedException.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BFF3712177E17C100192782 /* OFRenameItemFailedException.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 4BFF3717177E17C100192782 /* OFRenameItemFailedException.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BFF3713177E17C100192782 /* OFRenameItemFailedException.m */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ 4B23CA8E133811B20047A1D9 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; @@ -609,14 +609,10 @@ 4B55A10D133AC24500B58A93 /* OFReadFailedException.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFReadFailedException.m; path = src/exceptions/OFReadFailedException.m; sourceTree = ""; }; 4B55A10E133AC24500B58A93 /* OFReadOrWriteFailedException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFReadOrWriteFailedException.h; path = src/exceptions/OFReadOrWriteFailedException.h; sourceTree = ""; }; 4B55A10F133AC24500B58A93 /* OFReadOrWriteFailedException.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFReadOrWriteFailedException.m; path = src/exceptions/OFReadOrWriteFailedException.m; sourceTree = ""; }; 4B55A110133AC24500B58A93 /* OFWriteFailedException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFWriteFailedException.h; path = src/exceptions/OFWriteFailedException.h; sourceTree = ""; }; 4B55A111133AC24600B58A93 /* OFWriteFailedException.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFWriteFailedException.m; path = src/exceptions/OFWriteFailedException.m; sourceTree = ""; }; - 4B55ADEF177BAE290013D88E /* OFRemoveFailedException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFRemoveFailedException.h; path = src/exceptions/OFRemoveFailedException.h; sourceTree = ""; }; - 4B55ADF0177BAE290013D88E /* OFRemoveFailedException.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFRemoveFailedException.m; path = src/exceptions/OFRemoveFailedException.m; sourceTree = ""; }; - 4B55ADF1177BAE290013D88E /* OFRenameFailedException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFRenameFailedException.h; path = src/exceptions/OFRenameFailedException.h; sourceTree = ""; }; - 4B55ADF2177BAE290013D88E /* OFRenameFailedException.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFRenameFailedException.m; path = src/exceptions/OFRenameFailedException.m; sourceTree = ""; }; 4B5CF8F614940BD2007AA324 /* OFString+JSONValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "OFString+JSONValue.h"; path = "src/OFString+JSONValue.h"; sourceTree = ""; }; 4B5CF8F714940BD2007AA324 /* OFString+JSONValue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "OFString+JSONValue.m"; path = "src/OFString+JSONValue.m"; sourceTree = ""; }; 4B64D6EB1425381E007BDFB1 /* OFStreamObserver_poll.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFStreamObserver_poll.h; path = src/OFStreamObserver_poll.h; sourceTree = ""; }; 4B64D6EC1425381E007BDFB1 /* OFStreamObserver_poll.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFStreamObserver_poll.m; path = src/OFStreamObserver_poll.m; sourceTree = ""; }; 4B64D6ED1425381E007BDFB1 /* OFStreamObserver_select.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFStreamObserver_select.h; path = src/OFStreamObserver_select.h; sourceTree = ""; }; @@ -828,10 +824,14 @@ 4BF33B4213380CD40059CEF7 /* testfile.bin */ = {isa = PBXFileReference; lastKnownFileType = archive.macbinary; name = testfile.bin; path = tests/testfile.bin; sourceTree = ""; }; 4BF33B4313380CD40059CEF7 /* testfile.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = testfile.txt; path = tests/testfile.txt; sourceTree = ""; }; 4BFBDD1610A0724800051AFB /* unicode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = unicode.m; path = src/unicode.m; sourceTree = ""; }; 4BFDB4CE168B939A006A4027 /* OFHTTPRequestReply.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFHTTPRequestReply.h; path = src/OFHTTPRequestReply.h; sourceTree = ""; }; 4BFDB4CF168B939A006A4027 /* OFHTTPRequestReply.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFHTTPRequestReply.m; path = src/OFHTTPRequestReply.m; sourceTree = ""; }; + 4BFF3710177E17C100192782 /* OFRemoveItemFailedException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFRemoveItemFailedException.h; path = src/exceptions/OFRemoveItemFailedException.h; sourceTree = ""; }; + 4BFF3711177E17C100192782 /* OFRemoveItemFailedException.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFRemoveItemFailedException.m; path = src/exceptions/OFRemoveItemFailedException.m; sourceTree = ""; }; + 4BFF3712177E17C100192782 /* OFRenameItemFailedException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFRenameItemFailedException.h; path = src/exceptions/OFRenameItemFailedException.h; sourceTree = ""; }; + 4BFF3713177E17C100192782 /* OFRenameItemFailedException.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFRenameItemFailedException.m; path = src/exceptions/OFRenameItemFailedException.m; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 4B187E0A163EA29F0049A832 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; @@ -957,14 +957,14 @@ 4B17FF7A133A2C15003E6DCD /* OFOutOfRangeException.m */, 4B55A10C133AC24500B58A93 /* OFReadFailedException.h */, 4B55A10D133AC24500B58A93 /* OFReadFailedException.m */, 4B55A10E133AC24500B58A93 /* OFReadOrWriteFailedException.h */, 4B55A10F133AC24500B58A93 /* OFReadOrWriteFailedException.m */, - 4B55ADEF177BAE290013D88E /* OFRemoveFailedException.h */, - 4B55ADF0177BAE290013D88E /* OFRemoveFailedException.m */, - 4B55ADF1177BAE290013D88E /* OFRenameFailedException.h */, - 4B55ADF2177BAE290013D88E /* OFRenameFailedException.m */, + 4BFF3710177E17C100192782 /* OFRemoveItemFailedException.h */, + 4BFF3711177E17C100192782 /* OFRemoveItemFailedException.m */, + 4BFF3712177E17C100192782 /* OFRenameItemFailedException.h */, + 4BFF3713177E17C100192782 /* OFRenameItemFailedException.m */, 4B29BC39133AC4E80004B236 /* OFSeekFailedException.h */, 4B29BC3A133AC4E80004B236 /* OFSeekFailedException.m */, 4B90B78B133AD46700BD33CB /* OFSetOptionFailedException.h */, 4B90B78C133AD46700BD33CB /* OFSetOptionFailedException.m */, 4B6743ED163C384A00EB1E59 /* OFStillLockedException.h */, @@ -1502,12 +1502,12 @@ 4B55A10A133AC05100B58A93 /* OFOpenFileFailedException.h in Headers */, 4B17FF83133A2DFB003E6DCD /* OFOutOfMemoryException.h in Headers */, 4B17FF7B133A2C15003E6DCD /* OFOutOfRangeException.h in Headers */, 4B55A112133AC24600B58A93 /* OFReadFailedException.h in Headers */, 4B55A114133AC24600B58A93 /* OFReadOrWriteFailedException.h in Headers */, - 4B55ADF3177BAE290013D88E /* OFRemoveFailedException.h in Headers */, - 4B55ADF5177BAE290013D88E /* OFRenameFailedException.h in Headers */, + 4BFF3714177E17C100192782 /* OFRemoveItemFailedException.h in Headers */, + 4BFF3716177E17C100192782 /* OFRenameItemFailedException.h in Headers */, 4B29BC41133AC4E80004B236 /* OFSeekFailedException.h in Headers */, 4B90B791133AD46700BD33CB /* OFSetOptionFailedException.h in Headers */, 4B6743F3163C384A00EB1E59 /* OFStillLockedException.h in Headers */, 4B17FFA9133A34E7003E6DCD /* OFTruncatedDataException.h in Headers */, 4B55A0FF133ABEA900B58A93 /* OFThreadJoinFailedException.h in Headers */, @@ -1855,12 +1855,12 @@ 4B55A10B133AC05100B58A93 /* OFOpenFileFailedException.m in Sources */, 4B17FF84133A2DFB003E6DCD /* OFOutOfMemoryException.m in Sources */, 4B17FF7C133A2C15003E6DCD /* OFOutOfRangeException.m in Sources */, 4B55A113133AC24600B58A93 /* OFReadFailedException.m in Sources */, 4B55A115133AC24600B58A93 /* OFReadOrWriteFailedException.m in Sources */, - 4B55ADF4177BAE290013D88E /* OFRemoveFailedException.m in Sources */, - 4B55ADF6177BAE290013D88E /* OFRenameFailedException.m in Sources */, + 4BFF3715177E17C100192782 /* OFRemoveItemFailedException.m in Sources */, + 4BFF3717177E17C100192782 /* OFRenameItemFailedException.m in Sources */, 4B29BC42133AC4E80004B236 /* OFSeekFailedException.m in Sources */, 4B90B792133AD46700BD33CB /* OFSetOptionFailedException.m in Sources */, 4B6743F4163C384A00EB1E59 /* OFStillLockedException.m in Sources */, 4B55A100133ABEA900B58A93 /* OFThreadJoinFailedException.m in Sources */, 4B55A102133ABEA900B58A93 /* OFThreadStartFailedException.m in Sources */, Index: src/OFFile.m ================================================================== --- src/OFFile.m +++ src/OFFile.m @@ -67,12 +67,12 @@ #import "OFLinkFailedException.h" #import "OFLockFailedException.h" #import "OFOpenFileFailedException.h" #import "OFOutOfMemoryException.h" #import "OFReadFailedException.h" -#import "OFRemoveFailedException.h" -#import "OFRenameFailedException.h" +#import "OFRemoveItemFailedException.h" +#import "OFRenameItemFailedException.h" #import "OFSeekFailedException.h" #import "OFUnlockFailedException.h" #import "OFWriteFailedException.h" #import "autorelease.h" @@ -241,11 +241,11 @@ DIR_MODE)) #else if (_wmkdir([path UTF16String])) #endif @throw [OFCreateDirectoryFailedException - exceptionWithPath: path]; + exceptionWithDirectoryPath: path]; } + (void)createDirectoryAtPath: (OFString*)path createParents: (bool)createParents { @@ -362,11 +362,11 @@ if (chdir([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE])) #else if (_wchdir([path UTF16String])) #endif @throw [OFChangeCurrentDirectoryPathFailedException - exceptionWithPath: path]; + exceptionWithDirectoryPath: path]; } + (off_t)sizeOfFileAtPath: (OFString*)path { #ifndef _WIN32 @@ -552,11 +552,11 @@ if (rename([source cStringWithEncoding: OF_STRING_ENCODING_NATIVE], [destination cStringWithEncoding: OF_STRING_ENCODING_NATIVE])) #else if (_wrename([source UTF16String], [destination UTF16String])) #endif - @throw [OFRenameFailedException + @throw [OFRenameItemFailedException exceptionWithSourcePath: source destinationPath: destination]; objc_autoreleasePoolPop(pool); } @@ -566,11 +566,12 @@ #ifndef _WIN32 if (remove([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE])) #else if (_wremove([path UTF16String])) #endif - @throw [OFRemoveFailedException exceptionWithPath: path]; + @throw [OFRemoveItemFailedException + exceptionWithItemPath: path]; } #ifdef OF_HAVE_LINK + (void)linkItemAtPath: (OFString*)source toPath: (OFString*)destination Index: src/ObjFW.h ================================================================== --- src/ObjFW.h +++ src/ObjFW.h @@ -132,12 +132,12 @@ #import "OFOpenFileFailedException.h" #import "OFOutOfMemoryException.h" #import "OFOutOfRangeException.h" #import "OFReadFailedException.h" #import "OFReadOrWriteFailedException.h" -#import "OFRemoveFailedException.h" -#import "OFRenameFailedException.h" +#import "OFRemoveItemFailedException.h" +#import "OFRenameItemFailedException.h" #import "OFSeekFailedException.h" #import "OFSetOptionFailedException.h" #import "OFStillLockedException.h" #ifdef OF_HAVE_THREADS # import "OFThreadJoinFailedException.h" Index: src/exceptions/Makefile ================================================================== --- src/exceptions/Makefile +++ src/exceptions/Makefile @@ -27,12 +27,12 @@ OFOpenFileFailedException.m \ OFOutOfMemoryException.m \ OFOutOfRangeException.m \ OFReadFailedException.m \ OFReadOrWriteFailedException.m \ - OFRemoveFailedException.m \ - OFRenameFailedException.m \ + OFRemoveItemFailedException.m \ + OFRenameItemFailedException.m \ OFSeekFailedException.m \ OFSetOptionFailedException.m \ OFStillLockedException.m \ OFTruncatedDataException.m \ OFUnboundNamespaceException.m \ Index: src/exceptions/OFChangeCurrentDirectoryPathFailedException.h ================================================================== --- src/exceptions/OFChangeCurrentDirectoryPathFailedException.h +++ src/exceptions/OFChangeCurrentDirectoryPathFailedException.h @@ -22,49 +22,49 @@ * @brief An exception indicating that changing the current directory path * failed. */ @interface OFChangeCurrentDirectoryPathFailedException: OFException { - OFString *_path; + OFString *_directoryPath; int _errNo; } #ifdef OF_HAVE_PROPERTIES -@property (readonly, copy, nonatomic) OFString *path; +@property (readonly, copy, nonatomic) OFString *directoryPath; @property (readonly) int errNo; #endif /*! * @brief Creates a new, autoreleased change current directory path failed * exception. * - * @param path The path of the directory to which the current path could not be - * changed + * @param directoryPath The path of the directory to which the current path + * could not be changed * @return A new, autoreleased change current directory path failed exception */ -+ (instancetype)exceptionWithPath: (OFString*)path; ++ (instancetype)exceptionWithDirectoryPath: (OFString*)directoryPath; /*! * @brief Initializes an already allocated change directory failed exception. * - * @param path The path of the directory to which the current path could not be - * changed + * @param directoryPath The path of the directory to which the current path + * could not be changed * @return An initialized change current directory path failed exception */ -- initWithPath: (OFString*)path; +- initWithDirectoryPath: (OFString*)directoryPath; /*! * @brief Returns the path of the directory to which the current path could not * be changed. * * @return The path of the directory to which the current path could not be * changed */ -- (OFString*)path; +- (OFString*)directoryPath; /*! * @brief Returns the errno from when the exception was created. * * @return The errno from when the exception was created */ - (int)errNo; @end Index: src/exceptions/OFChangeCurrentDirectoryPathFailedException.m ================================================================== --- src/exceptions/OFChangeCurrentDirectoryPathFailedException.m +++ src/exceptions/OFChangeCurrentDirectoryPathFailedException.m @@ -22,13 +22,14 @@ #import "OFString.h" #import "common.h" @implementation OFChangeCurrentDirectoryPathFailedException -+ (instancetype)exceptionWithPath: (OFString*)path ++ (instancetype)exceptionWithDirectoryPath: (OFString*)directoryPath { - return [[[self alloc] initWithPath: path] autorelease]; + return [[[self alloc] + initWithDirectoryPath: directoryPath] autorelease]; } - init { @try { @@ -39,16 +40,16 @@ } abort(); } -- initWithPath: (OFString*)path +- initWithDirectoryPath: (OFString*)directoryPath { self = [super init]; @try { - _path = [path copy]; + _directoryPath = [directoryPath copy]; _errNo = GET_ERRNO; } @catch (id e) { [self release]; @throw e; } @@ -56,27 +57,27 @@ return self; } - (void)dealloc { - [_path release]; + [_directoryPath release]; [super dealloc]; } - (OFString*)description { return [OFString stringWithFormat: @"Failed to change the current directory path to %@! " ERRFMT, - _path, ERRPARAM]; + _directoryPath, ERRPARAM]; } -- (OFString*)path +- (OFString*)directoryPath { - OF_GETTER(_path, false) + OF_GETTER(_directoryPath, false) } - (int)errNo { return _errNo; } @end Index: src/exceptions/OFCreateDirectoryFailedException.h ================================================================== --- src/exceptions/OFCreateDirectoryFailedException.h +++ src/exceptions/OFCreateDirectoryFailedException.h @@ -21,45 +21,47 @@ /*! * @brief An exception indicating a directory couldn't be created. */ @interface OFCreateDirectoryFailedException: OFException { - OFString *_path; + OFString *_directoryPath; int _errNo; } #ifdef OF_HAVE_PROPERTIES -@property (readonly, copy, nonatomic) OFString *path; +@property (readonly, copy, nonatomic) OFString *directoryPath; @property (readonly) int errNo; #endif /*! * @brief Creates a new, autoreleased create directory failed exception. * - * @param path A string with the path of the directory which couldn't be created + * @param directoryPath A string with the path of the directory which couldn't + * be created * @return A new, autoreleased create directory failed exception */ -+ (instancetype)exceptionWithPath: (OFString*)path; ++ (instancetype)exceptionWithDirectoryPath: (OFString*)directoryPath; /*! * @brief Initializes an already allocated create directory failed exception. * - * @param path A string with the path of the directory which couldn't be created + * @param directoryPath A string with the path of the directory which couldn't + * be created * @return An initialized create directory failed exception */ -- initWithPath: (OFString*)path; +- initWithDirectoryPath: (OFString*)directoryPath; /*! * @brief Returns a string with the path of the directory which couldn't be * created. * * @return A string with the path of the directory which couldn't be created */ -- (OFString*)path; +- (OFString*)directoryPath; /*! * @brief Returns the errno from when the exception was created. * * @return The errno from when the exception was created */ - (int)errNo; @end Index: src/exceptions/OFCreateDirectoryFailedException.m ================================================================== --- src/exceptions/OFCreateDirectoryFailedException.m +++ src/exceptions/OFCreateDirectoryFailedException.m @@ -22,13 +22,14 @@ #import "OFString.h" #import "common.h" @implementation OFCreateDirectoryFailedException -+ (instancetype)exceptionWithPath: (OFString*)path ++ (instancetype)exceptionWithDirectoryPath: (OFString*)directoryPath { - return [[[self alloc] initWithPath: path] autorelease]; + return [[[self alloc] + initWithDirectoryPath: directoryPath] autorelease]; } - init { @try { @@ -39,16 +40,16 @@ } abort(); } -- initWithPath: (OFString*)path +- initWithDirectoryPath: (OFString*)directoryPath { self = [super init]; @try { - _path = [path copy]; + _directoryPath = [directoryPath copy]; _errNo = GET_ERRNO; } @catch (id e) { [self release]; @throw e; } @@ -56,26 +57,27 @@ return self; } - (void)dealloc { - [_path release]; + [_directoryPath release]; [super dealloc]; } - (OFString*)description { return [OFString stringWithFormat: - @"Failed to create directory %@! " ERRFMT, _path, ERRPARAM]; + @"Failed to create directory %@! " ERRFMT, + _directoryPath, ERRPARAM]; } -- (OFString*)path +- (OFString*)directoryPath { - OF_GETTER(_path, false) + OF_GETTER(_directoryPath, false) } - (int)errNo { return _errNo; } @end DELETED src/exceptions/OFRemoveFailedException.h Index: src/exceptions/OFRemoveFailedException.h ================================================================== --- src/exceptions/OFRemoveFailedException.h +++ src/exceptions/OFRemoveFailedException.h @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 - * Jonathan Schleifer - * - * All rights reserved. - * - * This file is part of ObjFW. It may be distributed under the terms of the - * Q Public License 1.0, which can be found in the file LICENSE.QPL included in - * the packaging of this file. - * - * Alternatively, it may be distributed under the terms of the GNU General - * Public License, either version 2 or 3, which can be found in the file - * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this - * file. - */ - -#include - -#import "OFException.h" - -/*! - * @brief An exception indicating that removing an item failed. - */ -@interface OFRemoveFailedException: OFException -{ - OFString *_path; - int _errNo; -} - -#ifdef OF_HAVE_PROPERTIES -@property (readonly, copy, nonatomic) OFString *path; -@property (readonly) int errNo; -#endif - -/*! - * @brief Creates a new, autoreleased remove failed exception. - * - * @param path The path of the item which could not be removed - * @return A new, autoreleased remove item failed exception - */ -+ (instancetype)exceptionWithPath: (OFString*)path; - -/*! - * @brief Initializes an already allocated remove failed exception. - * - * @param path The path of the item which could not be removed - * @return An initialized remove item failed exception - */ -- initWithPath: (OFString*)path; - -/*! - * @brief Returns the path of the item which could not be removed. - * - * @return The path of the item which could not be removed - */ -- (OFString*)path; - -/*! - * @brief Returns the errno from when the exception was created. - * - * @return The errno from when the exception was created - */ -- (int)errNo; -@end DELETED src/exceptions/OFRemoveFailedException.m Index: src/exceptions/OFRemoveFailedException.m ================================================================== --- src/exceptions/OFRemoveFailedException.m +++ src/exceptions/OFRemoveFailedException.m @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 - * Jonathan Schleifer - * - * All rights reserved. - * - * This file is part of ObjFW. It may be distributed under the terms of the - * Q Public License 1.0, which can be found in the file LICENSE.QPL included in - * the packaging of this file. - * - * Alternatively, it may be distributed under the terms of the GNU General - * Public License, either version 2 or 3, which can be found in the file - * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this - * file. - */ - -#include "config.h" - -#include - -#import "OFRemoveFailedException.h" -#import "OFString.h" - -#import "common.h" - -@implementation OFRemoveFailedException -+ (instancetype)exceptionWithPath: (OFString*)path -{ - return [[[self alloc] initWithPath: path] autorelease]; -} - -- init -{ - @try { - [self doesNotRecognizeSelector: _cmd]; - } @catch (id e) { - [self release]; - @throw e; - } - - abort(); -} - -- initWithPath: (OFString*)path -{ - self = [super init]; - - @try { - _path = [path copy]; - _errNo = GET_ERRNO; - } @catch (id e) { - [self release]; - @throw e; - } - - return self; -} - -- (void)dealloc -{ - [_path release]; - - [super dealloc]; -} - -- (OFString*)description -{ - return [OFString stringWithFormat: - @"Failed to remove item at path %@! " ERRFMT, _path, ERRPARAM]; -} - -- (OFString*)path -{ - OF_GETTER(_path, false) -} - -- (int)errNo -{ - return _errNo; -} -@end ADDED src/exceptions/OFRemoveItemFailedException.h Index: src/exceptions/OFRemoveItemFailedException.h ================================================================== --- src/exceptions/OFRemoveItemFailedException.h +++ src/exceptions/OFRemoveItemFailedException.h @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 + * Jonathan Schleifer + * + * All rights reserved. + * + * This file is part of ObjFW. It may be distributed under the terms of the + * Q Public License 1.0, which can be found in the file LICENSE.QPL included in + * the packaging of this file. + * + * Alternatively, it may be distributed under the terms of the GNU General + * Public License, either version 2 or 3, which can be found in the file + * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this + * file. + */ + +#include + +#import "OFException.h" + +/*! + * @brief An exception indicating that removing an item failed. + */ +@interface OFRemoveItemFailedException: OFException +{ + OFString *_itemPath; + int _errNo; +} + +#ifdef OF_HAVE_PROPERTIES +@property (readonly, copy, nonatomic) OFString *itemPath; +@property (readonly) int errNo; +#endif + +/*! + * @brief Creates a new, autoreleased remove failed exception. + * + * @param itemPath The path of the item which could not be removed + * @return A new, autoreleased remove item failed exception + */ ++ (instancetype)exceptionWithItemPath: (OFString*)itemPath; + +/*! + * @brief Initializes an already allocated remove failed exception. + * + * @param itemPath The path of the item which could not be removed + * @return An initialized remove item failed exception + */ +- initWithItemPath: (OFString*)itemPath; + +/*! + * @brief Returns the path of the item which could not be removed. + * + * @return The path of the item which could not be removed + */ +- (OFString*)itemPath; + +/*! + * @brief Returns the errno from when the exception was created. + * + * @return The errno from when the exception was created + */ +- (int)errNo; +@end ADDED src/exceptions/OFRemoveItemFailedException.m Index: src/exceptions/OFRemoveItemFailedException.m ================================================================== --- src/exceptions/OFRemoveItemFailedException.m +++ src/exceptions/OFRemoveItemFailedException.m @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 + * Jonathan Schleifer + * + * All rights reserved. + * + * This file is part of ObjFW. It may be distributed under the terms of the + * Q Public License 1.0, which can be found in the file LICENSE.QPL included in + * the packaging of this file. + * + * Alternatively, it may be distributed under the terms of the GNU General + * Public License, either version 2 or 3, which can be found in the file + * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this + * file. + */ + +#include "config.h" + +#include + +#import "OFRemoveItemFailedException.h" +#import "OFString.h" + +#import "common.h" + +@implementation OFRemoveItemFailedException ++ (instancetype)exceptionWithItemPath: (OFString*)itemPath +{ + return [[[self alloc] initWithItemPath: itemPath] autorelease]; +} + +- init +{ + @try { + [self doesNotRecognizeSelector: _cmd]; + } @catch (id e) { + [self release]; + @throw e; + } + + abort(); +} + +- initWithItemPath: (OFString*)itemPath +{ + self = [super init]; + + @try { + _itemPath = [itemPath copy]; + _errNo = GET_ERRNO; + } @catch (id e) { + [self release]; + @throw e; + } + + return self; +} + +- (void)dealloc +{ + [_itemPath release]; + + [super dealloc]; +} + +- (OFString*)description +{ + return [OFString stringWithFormat: + @"Failed to remove item at path %@! " ERRFMT, _itemPath, ERRPARAM]; +} + +- (OFString*)itemPath +{ + OF_GETTER(_itemPath, false) +} + +- (int)errNo +{ + return _errNo; +} +@end DELETED src/exceptions/OFRenameFailedException.h Index: src/exceptions/OFRenameFailedException.h ================================================================== --- src/exceptions/OFRenameFailedException.h +++ src/exceptions/OFRenameFailedException.h @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 - * Jonathan Schleifer - * - * All rights reserved. - * - * This file is part of ObjFW. It may be distributed under the terms of the - * Q Public License 1.0, which can be found in the file LICENSE.QPL included in - * the packaging of this file. - * - * Alternatively, it may be distributed under the terms of the GNU General - * Public License, either version 2 or 3, which can be found in the file - * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this - * file. - */ - -#include - -#import "OFException.h" - -/*! - * @brief An exception indicating that renaming an item failed. - */ -@interface OFRenameFailedException: OFException -{ - OFString *_sourcePath, *_destinationPath; - int _errNo; -} - -#ifdef OF_HAVE_PROPERTIES -@property (readonly, copy, nonatomic) OFString *sourcePath, *destinationPath; -@property (readonly) int errNo; -#endif - -/*! - * @brief Creates a new, autoreleased rename failed exception. - * - * @param sourcePath The original path - * @param destinationPath The new path - * @return A new, autoreleased rename failed exception - */ -+ (instancetype)exceptionWithSourcePath: (OFString*)sourcePath - destinationPath: (OFString*)destinationPath; - -/*! - * @brief Initializes an already allocated rename failed exception. - * - * @param sourcePath The original path - * @param destinationPath The new path - * @return An initialized rename failed exception - */ -- initWithSourcePath: (OFString*)sourcePath - destinationPath: (OFString*)destinationPath; - -/*! - * @brief Returns the original path. - * - * @return The original path - */ -- (OFString*)sourcePath; - -/*! - * @brief Returns the new path. - * - * @return The new path - */ -- (OFString*)destinationPath; - -/*! - * @brief Returns the errno from when the exception was created. - * - * @return The errno from when the exception was created - */ -- (int)errNo; -@end DELETED src/exceptions/OFRenameFailedException.m Index: src/exceptions/OFRenameFailedException.m ================================================================== --- src/exceptions/OFRenameFailedException.m +++ src/exceptions/OFRenameFailedException.m @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 - * Jonathan Schleifer - * - * All rights reserved. - * - * This file is part of ObjFW. It may be distributed under the terms of the - * Q Public License 1.0, which can be found in the file LICENSE.QPL included in - * the packaging of this file. - * - * Alternatively, it may be distributed under the terms of the GNU General - * Public License, either version 2 or 3, which can be found in the file - * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this - * file. - */ - -#include "config.h" - -#include - -#import "OFRenameFailedException.h" -#import "OFString.h" - -#import "common.h" - -@implementation OFRenameFailedException -+ (instancetype)exceptionWithSourcePath: (OFString*)sourcePath - destinationPath: (OFString*)destinationPath -{ - return [[[self alloc] initWithSourcePath: sourcePath - destinationPath: destinationPath] autorelease]; -} - -- init -{ - @try { - [self doesNotRecognizeSelector: _cmd]; - } @catch (id e) { - [self release]; - @throw e; - } - - abort(); -} - -- initWithSourcePath: (OFString*)sourcePath - destinationPath: (OFString*)destinationPath -{ - self = [super init]; - - @try { - _sourcePath = [sourcePath copy]; - _destinationPath = [destinationPath copy]; - _errNo = GET_ERRNO; - } @catch (id e) { - [self release]; - @throw e; - } - - return self; -} - -- (void)dealloc -{ - [_sourcePath release]; - [_destinationPath release]; - - [super dealloc]; -} - -- (OFString*)description -{ - return [OFString stringWithFormat: - @"Failed to rename item at path %@ to %@! " ERRFMT, _sourcePath, - _destinationPath, ERRPARAM]; -} - -- (OFString*)sourcePath -{ - OF_GETTER(_sourcePath, false) -} - -- (OFString*)destinationPath -{ - OF_GETTER(_destinationPath, false) -} - -- (int)errNo -{ - return _errNo; -} -@end ADDED src/exceptions/OFRenameItemFailedException.h Index: src/exceptions/OFRenameItemFailedException.h ================================================================== --- src/exceptions/OFRenameItemFailedException.h +++ src/exceptions/OFRenameItemFailedException.h @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 + * Jonathan Schleifer + * + * All rights reserved. + * + * This file is part of ObjFW. It may be distributed under the terms of the + * Q Public License 1.0, which can be found in the file LICENSE.QPL included in + * the packaging of this file. + * + * Alternatively, it may be distributed under the terms of the GNU General + * Public License, either version 2 or 3, which can be found in the file + * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this + * file. + */ + +#include + +#import "OFException.h" + +/*! + * @brief An exception indicating that renaming an item failed. + */ +@interface OFRenameItemFailedException: OFException +{ + OFString *_sourcePath, *_destinationPath; + int _errNo; +} + +#ifdef OF_HAVE_PROPERTIES +@property (readonly, copy, nonatomic) OFString *sourcePath, *destinationPath; +@property (readonly) int errNo; +#endif + +/*! + * @brief Creates a new, autoreleased rename failed exception. + * + * @param sourcePath The original path + * @param destinationPath The new path + * @return A new, autoreleased rename failed exception + */ ++ (instancetype)exceptionWithSourcePath: (OFString*)sourcePath + destinationPath: (OFString*)destinationPath; + +/*! + * @brief Initializes an already allocated rename failed exception. + * + * @param sourcePath The original path + * @param destinationPath The new path + * @return An initialized rename failed exception + */ +- initWithSourcePath: (OFString*)sourcePath + destinationPath: (OFString*)destinationPath; + +/*! + * @brief Returns the original path. + * + * @return The original path + */ +- (OFString*)sourcePath; + +/*! + * @brief Returns the new path. + * + * @return The new path + */ +- (OFString*)destinationPath; + +/*! + * @brief Returns the errno from when the exception was created. + * + * @return The errno from when the exception was created + */ +- (int)errNo; +@end ADDED src/exceptions/OFRenameItemFailedException.m Index: src/exceptions/OFRenameItemFailedException.m ================================================================== --- src/exceptions/OFRenameItemFailedException.m +++ src/exceptions/OFRenameItemFailedException.m @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 + * Jonathan Schleifer + * + * All rights reserved. + * + * This file is part of ObjFW. It may be distributed under the terms of the + * Q Public License 1.0, which can be found in the file LICENSE.QPL included in + * the packaging of this file. + * + * Alternatively, it may be distributed under the terms of the GNU General + * Public License, either version 2 or 3, which can be found in the file + * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this + * file. + */ + +#include "config.h" + +#include + +#import "OFRenameItemFailedException.h" +#import "OFString.h" + +#import "common.h" + +@implementation OFRenameItemFailedException ++ (instancetype)exceptionWithSourcePath: (OFString*)sourcePath + destinationPath: (OFString*)destinationPath +{ + return [[[self alloc] initWithSourcePath: sourcePath + destinationPath: destinationPath] autorelease]; +} + +- init +{ + @try { + [self doesNotRecognizeSelector: _cmd]; + } @catch (id e) { + [self release]; + @throw e; + } + + abort(); +} + +- initWithSourcePath: (OFString*)sourcePath + destinationPath: (OFString*)destinationPath +{ + self = [super init]; + + @try { + _sourcePath = [sourcePath copy]; + _destinationPath = [destinationPath copy]; + _errNo = GET_ERRNO; + } @catch (id e) { + [self release]; + @throw e; + } + + return self; +} + +- (void)dealloc +{ + [_sourcePath release]; + [_destinationPath release]; + + [super dealloc]; +} + +- (OFString*)description +{ + return [OFString stringWithFormat: + @"Failed to rename item at path %@ to %@! " ERRFMT, _sourcePath, + _destinationPath, ERRPARAM]; +} + +- (OFString*)sourcePath +{ + OF_GETTER(_sourcePath, false) +} + +- (OFString*)destinationPath +{ + OF_GETTER(_destinationPath, false) +} + +- (int)errNo +{ + return _errNo; +} +@end