Index: src/OFFileIRIHandler.m ================================================================== --- src/OFFileIRIHandler.m +++ src/OFFileIRIHandler.m @@ -668,16 +668,22 @@ (__time64_t)lastAccessDate.timeIntervalSince1970, .modtime = (__time64_t)modificationDate.timeIntervalSince1970 }; - if (_wutime64FuncPtr([path UTF16String], ×) != 0) + if (_wutime64FuncPtr([path UTF16String], ×) != 0) { + int errNo = errno; + + if (errNo == EACCES && [self directoryExistsAtIRI: IRI]) + errNo = EISDIR; + @throw [OFSetItemAttributesFailedException exceptionWithIRI: IRI attributes: attributes failedAttribute: attributeKey - errNo: errno]; + errNo: errNo]; + } } else { struct _utimbuf times = { .actime = (time_t)lastAccessDate.timeIntervalSince1970, .modtime = (time_t)modificationDate.timeIntervalSince1970 @@ -689,16 +695,22 @@ else status = _utime( [path cStringWithEncoding: [OFLocale encoding]], ×); - if (status != 0) + if (status != 0) { + int errNo = errno; + + if (errNo == EACCES && [self directoryExistsAtIRI: IRI]) + errNo = EISDIR; + @throw [OFSetItemAttributesFailedException exceptionWithIRI: IRI attributes: attributes failedAttribute: attributeKey - errNo: errno]; + errNo: errNo]; + } } #elif defined(OF_AMIGAOS) /* AmigaOS does not support access time. */ OFTimeInterval modificationTime = modificationDate.timeIntervalSince1970;