Overview
Context
Changes
Modified src/OFFile.h
from [a381f6647c]
to [33109fbbdb].
︙ | | |
113
114
115
116
117
118
119
120
121
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
|
113
114
115
116
117
118
119
120
121
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
|
-
+
-
+
-
+
-
-
+
+
-
-
-
+
+
+
|
+ (OFArray*)filesInDirectoryAtPath: (OFString*)path;
/**
* \brief Changes the current working directory.
*
* \param path The new directory to change to
*/
+ (void)changeToDirectory: (OFString*)path;
+ (void)changeToDirectoryAtPath: (OFString*)path;
/**
* \brief Returns the size of the specified file.
*
* \return The size of the specified file
*/
+ (off_t)sizeOfFile: (OFString*)path;
+ (off_t)sizeOfFileAtPath: (OFString*)path;
/**
* \brief Returns the date of the last modification of the file.
*
* \return The date of the last modification of the file
*/
+ (OFDate*)modificationDateOfFile: (OFString*)path;
+ (OFDate*)modificationDateOfFileAtPath: (OFString*)path;
#ifndef _PSP
/**
* \brief 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
* \param mode The new mode for the file
*/
+ (void)changeModeOfFile: (OFString*)path
toMode: (mode_t)mode;
+ (void)changeModeOfFileAtPath: (OFString*)path
mode: (mode_t)mode;
#endif
#if !defined(_WIN32) && !defined(_PSP)
/**
* \brief Changes the owner of a file.
*
* Not available on Windows.
*
* \param path The path to the file of which the owner should be changed as a
* string
* \param owner The new owner for the file
* \param group The new group for the file
*/
+ (void)changeOwnerOfFile: (OFString*)path
toOwner: (OFString*)owner
group: (OFString*)group;
+ (void)changeOwnerOfFileAtPath: (OFString*)path
owner: (OFString*)owner
group: (OFString*)group;
#endif
/**
* \brief Copies a file.
*
* \param source The file to copy
* \param destination The destination path
|
︙ | | |
Modified src/OFFile.m
from [9427d5f441]
to [9e887a707d].
︙ | | |
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
|
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
|
-
+
-
-
+
+
|
#endif
[files makeImmutable];
return files;
}
+ (void)changeToDirectory: (OFString*)path
+ (void)changeToDirectoryAtPath: (OFString*)path
{
if (chdir([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE]))
@throw [OFChangeDirectoryFailedException
exceptionWithClass: self
path: path];
}
#ifndef _PSP
+ (void)changeModeOfFile: (OFString*)path
toMode: (mode_t)mode
+ (void)changeModeOfFileAtPath: (OFString*)path
mode: (mode_t)mode
{
# ifndef _WIN32
if (chmod([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE], mode))
@throw [OFChangeFileModeFailedException
exceptionWithClass: self
path: path
mode: mode];
|
︙ | | |
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
|
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
|
-
+
-
+
-
-
-
+
+
+
|
exceptionWithClass: self
path: path
mode: mode];
# endif
}
#endif
+ (off_t)sizeOfFile: (OFString*)path
+ (off_t)sizeOfFileAtPath: (OFString*)path
{
struct stat s;
if (stat([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE],
&s) == -1)
/* FIXME: Maybe use another exception? */
@throw [OFOpenFileFailedException exceptionWithClass: self
path: path
mode: @"r"];
return s.st_size;
}
+ (OFDate*)modificationDateOfFile: (OFString*)path
+ (OFDate*)modificationDateOfFileAtPath: (OFString*)path
{
struct stat s;
if (stat([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE],
&s) == -1)
/* FIXME: Maybe use another exception? */
@throw [OFOpenFileFailedException exceptionWithClass: self
path: path
mode: @"r"];
/* FIXME: We could be more precise on some OSes */
return [OFDate dateWithTimeIntervalSince1970: s.st_mtime];
}
#if !defined(_WIN32) && !defined(_PSP)
+ (void)changeOwnerOfFile: (OFString*)path
toOwner: (OFString*)owner
group: (OFString*)group
+ (void)changeOwnerOfFileAtPath: (OFString*)path
owner: (OFString*)owner
group: (OFString*)group
{
uid_t uid = -1;
gid_t gid = -1;
if (owner == nil && group == nil)
@throw [OFInvalidArgumentException exceptionWithClass: self
selector: _cmd];
|
︙ | | |