Overview
Comment: | Add +[OFFile modificationDateOfFile:] and change -[OFDate description]. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
2d8533a42882f29b0609c2cfaa81960f |
User & Date: | js on 2010-12-25 23:29:23 |
Other Links: | manifest | tags |
Context
2010-12-26
| ||
00:01 |
Don't use strlen in -[appendCString:withLength:]. This might cause trouble if the string is not terminated. check-in: 05207af0f6 user: js tags: trunk | |
2010-12-25
| ||
23:29 | Add +[OFFile modificationDateOfFile:] and change -[OFDate description]. check-in: 2d8533a428 user: js tags: trunk | |
19:31 | Add OFDate. check-in: 39cb19595d user: js tags: trunk | |
Changes
Modified src/OFDate.m from [d05453646d] to [6db7ed3798].
︙ | |||
122 123 124 125 126 127 128 | 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | - + - + | #ifdef HAVE_GMTIME_R struct tm tm; if (gmtime_r(&sec, &tm) == NULL) @throw [OFOutOfRangeException newWithClass: isa]; |
︙ |
Modified src/OFFile.h from [9662e52e67] to [ef787383be].
︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | + | #include <sys/types.h> #import "OFSeekableStream.h" @class OFString; @class OFArray; @class OFDate; /** * \brief A class which provides functions to read, write and manipulate files. */ @interface OFFile: OFSeekableStream { int fd; |
︙ | |||
87 88 89 90 91 92 93 94 95 96 97 98 99 100 | 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | + + + + + | /** * Changes the current working directory. * * \param path The new directory to change to */ + (void)changeToDirectory: (OFString*)path; /** * \return The date of the last modification of the file */ + (OFDate*)modificationDateOfFile: (OFString*)path; /** * Changes the mode of a file. * * Only changes read-only flag on Windows. * * \param path The path to the file of which the mode should be changed as a * string |
︙ |
Modified src/OFFile.m from [527617a46d] to [0713e735b4].
︙ | |||
25 26 27 28 29 30 31 32 33 34 35 36 37 38 | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | + | # include <grp.h> #endif #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 # import <windows.h> #endif |
︙ | |||
388 389 390 391 392 393 394 395 396 397 398 399 400 401 | 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 | + + + + + + + + + + + + + + | if (!SetFileAttributes([path cString], attrs)) @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 { uid_t uid = -1; |
︙ |
Modified tests/OFDateTests.m from [02c7704541] to [9d404af2db].
︙ | |||
29 30 31 32 33 34 35 | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | - - + + | (d1 = [OFDate dateWithTimeIntervalSince1970: 0])) TEST(@"+[dateWithTimeIntervalSince1970:microseconds:", (d2 = [OFDate dateWithTimeIntervalSince1970: 3600 * 25 + 5 microseconds: 1])) TEST(@"-[description]", |
︙ |