@@ -27,10 +27,11 @@ #import "OFFile.h" #import "OFString.h" #import "OFArray.h" #import "OFThread.h" +#import "OFDate.h" #import "OFAutoreleasePool.h" #import "OFExceptions.h" #import "macros.h" #ifdef _WIN32 @@ -390,10 +391,24 @@ @throw [OFChangeFileModeFailedException newWithClass: self path: path mode: mode]; #endif } + ++ (OFDate*)modificationDateOfFile: (OFString*)path +{ + struct stat s; + + if (stat([path cString], &s) == -1) + /* FIXME: Maybe use another exception? */ + @throw [OFOpenFileFailedException newWithClass: self + path: path + mode: @"r"]; + + /* FIXME: We could be more precise on some OSes */ + return [OFDate dateWithTimeIntervalSince1970: s.st_mtime]; +} #ifndef _WIN32 + (void)changeOwnerOfFile: (OFString*)path toOwner: (OFString*)owner group: (OFString*)group