@@ -21,24 +21,22 @@ #import "OFChangeFileOwnerFailedException.h" #import "OFString.h" #import "common.h" -#ifndef _WIN32 +#ifdef OF_HAVE_CHOWN @implementation OFChangeFileOwnerFailedException -+ (instancetype)exceptionWithClass: (Class)class - path: (OFString*)path - owner: (OFString*)owner - group: (OFString*)group -{ - return [[[self alloc] initWithClass: class - path: path - owner: owner - group: group] autorelease]; ++ (instancetype)exceptionWithPath: (OFString*)path + owner: (OFString*)owner + group: (OFString*)group +{ + return [[[self alloc] initWithPath: path + owner: owner + group: group] autorelease]; } -- initWithClass: (Class)class +- init { @try { [self doesNotRecognizeSelector: _cmd]; } @catch (id e) { [self release]; @@ -46,16 +44,15 @@ } abort(); } -- initWithClass: (Class)class - path: (OFString*)path - owner: (OFString*)owner - group: (OFString*)group +- initWithPath: (OFString*)path + owner: (OFString*)owner + group: (OFString*)group { - self = [super initWithClass: class]; + self = [super init]; @try { _path = [path copy]; _owner = [owner copy]; _group = [group copy]; @@ -79,25 +76,20 @@ - (OFString*)description { if (_group == nil) return [OFString stringWithFormat: - @"Failed to change owner for file %@ to %@ in class %@! " - ERRFMT, _path, _owner, _inClass, ERRPARAM]; + @"Failed to change owner of file %@ to %@! " + ERRFMT, _path, _owner, ERRPARAM]; else if (_owner == nil) return [OFString stringWithFormat: - @"Failed to change group for file %@ to %@ in class %@! " - ERRFMT, _path, _group, _inClass, ERRPARAM]; + @"Failed to change group of file %@ to %@! " + ERRFMT, _path, _group, ERRPARAM]; else return [OFString stringWithFormat: - @"Failed to change owner for file %@ to %@:%@ in class %@! " - ERRFMT, _path, _owner, _group, _inClass, ERRPARAM]; -} - -- (int)errNo -{ - return _errNo; + @"Failed to change owner of file %@ to %@:%@! " + ERRFMT, _path, _owner, _group, ERRPARAM]; } - (OFString*)path { OF_GETTER(_path, false) @@ -110,7 +102,12 @@ - (OFString*)group { OF_GETTER(_group, false) } + +- (int)errNo +{ + return _errNo; +} @end #endif