Index: src/OFFile.h ================================================================== --- src/OFFile.h +++ src/OFFile.h @@ -154,15 +154,29 @@ * @return The size of the specified file */ + (of_offset_t)sizeOfFileAtPath: (OFString*)path; /*! - * @brief Returns the date of the last modification of the file. + * @brief Returns the last access time of the specified file. + * + * @return The last access time of the specified file + */ ++ (OFDate*)accessTimeOfItemAtPath: (OFString*)path; + +/*! + * @brief Returns the last modification time of the specified file. + * + * @return The last modification time of the specified file + */ ++ (OFDate*)modificationTimeOfItemAtPath: (OFString*)path; + +/*! + * @brief Returns the last status change time of the specified file. * - * @return The date of the last modification of the file + * @return The last status change time of the specified file */ -+ (OFDate*)modificationDateOfFileAtPath: (OFString*)path; ++ (OFDate*)statusChangeTimeOfItemAtPath: (OFString*)path; #ifdef OF_HAVE_CHMOD /*! * @brief Changes the permissions of an item. * Index: src/OFFile.m ================================================================== --- src/OFFile.m +++ src/OFFile.m @@ -531,11 +531,28 @@ errNo: errno]; return s.st_size; } -+ (OFDate*)modificationDateOfFileAtPath: (OFString*)path ++ (OFDate*)accessTimeOfItemAtPath: (OFString*)path +{ + of_stat_t s; + + if (path == nil) + @throw [OFInvalidArgumentException exception]; + + if (of_stat(path, &s) != 0) + /* FIXME: Maybe use another exception? */ + @throw [OFOpenFileFailedException exceptionWithPath: path + mode: @"r" + errNo: errno]; + + /* FIXME: We could be more precise on some OSes */ + return [OFDate dateWithTimeIntervalSince1970: s.st_atime]; +} + ++ (OFDate*)modificationTimeOfItemAtPath: (OFString*)path { of_stat_t s; if (path == nil) @throw [OFInvalidArgumentException exception]; @@ -547,10 +564,27 @@ errNo: errno]; /* FIXME: We could be more precise on some OSes */ return [OFDate dateWithTimeIntervalSince1970: s.st_mtime]; } + ++ (OFDate*)statusChangeTimeOfItemAtPath: (OFString*)path +{ + of_stat_t s; + + if (path == nil) + @throw [OFInvalidArgumentException exception]; + + if (of_stat(path, &s) != 0) + /* FIXME: Maybe use another exception? */ + @throw [OFOpenFileFailedException exceptionWithPath: path + mode: @"r" + errNo: errno]; + + /* FIXME: We could be more precise on some OSes */ + return [OFDate dateWithTimeIntervalSince1970: s.st_ctime]; +} #ifdef OF_HAVE_CHMOD + (void)changePermissionsOfItemAtPath: (OFString*)path permissions: (mode_t)permissions {