@@ -75,11 +75,11 @@ #import "OFInitializationFailedException.h" #import "OFInvalidArgumentException.h" #import "OFLinkFailedException.h" #import "OFLockFailedException.h" #import "OFMoveItemFailedException.h" -#import "OFOpenFileFailedException.h" +#import "OFOpenItemFailedException.h" #import "OFOutOfMemoryException.h" #import "OFOutOfRangeException.h" #import "OFReadFailedException.h" #import "OFRemoveItemFailedException.h" #import "OFSeekFailedException.h" @@ -392,12 +392,11 @@ DIR *dir; encoding = [OFSystemInfo native8BitEncoding]; if ((dir = opendir([path cStringWithEncoding: encoding])) == NULL) - @throw [OFOpenFileFailedException exceptionWithPath: path - mode: @"r" + @throw [OFOpenItemFailedException exceptionWithPath: path errNo: errno]; # if !defined(HAVE_READDIR_R) && defined(OF_HAVE_THREADS) if (!of_mutex_lock(&mutex)) @throw [OFLockFailedException exception]; @@ -464,12 +463,11 @@ int errNo = 0; if (GetLastError() == ERROR_FILE_NOT_FOUND) errNo = ENOENT; - @throw [OFOpenFileFailedException exceptionWithPath: path - mode: @"r" + @throw [OFOpenItemFailedException exceptionWithPath: path errNo: errNo]; } @try { do { @@ -524,12 +522,11 @@ if (path == nil) @throw [OFInvalidArgumentException exception]; if (of_stat(path, &s) != 0) /* FIXME: Maybe use another exception? */ - @throw [OFOpenFileFailedException exceptionWithPath: path - mode: @"r" + @throw [OFOpenItemFailedException exceptionWithPath: path errNo: errno]; return s.st_size; } @@ -540,12 +537,11 @@ if (path == nil) @throw [OFInvalidArgumentException exception]; if (of_stat(path, &s) != 0) /* FIXME: Maybe use another exception? */ - @throw [OFOpenFileFailedException exceptionWithPath: path - mode: @"r" + @throw [OFOpenItemFailedException exceptionWithPath: path errNo: errno]; /* FIXME: We could be more precise on some OSes */ return [OFDate dateWithTimeIntervalSince1970: s.st_atime]; } @@ -557,12 +553,11 @@ if (path == nil) @throw [OFInvalidArgumentException exception]; if (of_stat(path, &s) != 0) /* FIXME: Maybe use another exception? */ - @throw [OFOpenFileFailedException exceptionWithPath: path - mode: @"r" + @throw [OFOpenItemFailedException exceptionWithPath: path errNo: errno]; /* FIXME: We could be more precise on some OSes */ return [OFDate dateWithTimeIntervalSince1970: s.st_mtime]; } @@ -574,12 +569,11 @@ if (path == nil) @throw [OFInvalidArgumentException exception]; if (of_stat(path, &s) != 0) /* FIXME: Maybe use another exception? */ - @throw [OFOpenFileFailedException exceptionWithPath: path - mode: @"r" + @throw [OFOpenItemFailedException exceptionWithPath: path errNo: errno]; /* FIXME: We could be more precise on some OSes */ return [OFDate dateWithTimeIntervalSince1970: s.st_ctime]; } @@ -992,12 +986,12 @@ encoding = [OFSystemInfo native8BitEncoding]; length = readlink([path cStringWithEncoding: encoding], destination, PATH_MAX); if (length < 0) - @throw [OFOpenFileFailedException exceptionWithPath: path - mode: @"r" + /* FIXME: Maybe use another exception? */ + @throw [OFOpenItemFailedException exceptionWithPath: path errNo: errno]; return [OFString stringWithCString: destination encoding: encoding length: length]; @@ -1030,11 +1024,11 @@ native8BitEncoding]], flags, DEFAULT_MODE)) == -1) #else if ((_fd = open([path cStringWithEncoding: [OFSystemInfo native8BitEncoding]], flags, DEFAULT_MODE)) == -1) #endif - @throw [OFOpenFileFailedException + @throw [OFOpenItemFailedException exceptionWithPath: path mode: mode errNo: errno]; } @catch (id e) { [self release];