@@ -17,35 +17,36 @@ #include "config.h" #import "OFLinkFailedException.h" #import "OFString.h" -#import "common.h" - #ifdef OF_HAVE_LINK @implementation OFLinkFailedException + (instancetype)exceptionWithSourcePath: (OFString*)sourcePath destinationPath: (OFString*)destinationPath + errNo: (int)errNo { return [[[self alloc] initWithSourcePath: sourcePath - destinationPath: destinationPath] autorelease]; + destinationPath: destinationPath + errNo: errNo] autorelease]; } - init { OF_INVALID_INIT_METHOD } - initWithSourcePath: (OFString*)sourcePath destinationPath: (OFString*)destinationPath + errNo: (int)errNo { self = [super init]; @try { _sourcePath = [sourcePath copy]; _destinationPath = [destinationPath copy]; - _errNo = GET_ERRNO; + _errNo = errNo; } @catch (id e) { [self release]; @throw e; } @@ -61,12 +62,12 @@ } - (OFString*)description { return [OFString stringWithFormat: - @"Failed to link file %@ to %@! " ERRFMT, _sourcePath, - _destinationPath, ERRPARAM]; + @"Failed to link file %@ to %@: %@", + _sourcePath, _destinationPath, of_strerror(_errNo)]; } - (OFString*)sourcePath { OF_GETTER(_sourcePath, true)