ObjFW  Check-in [dd467ddb20]

Overview
Comment:OFFileManager: Add URL versions of all methods
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: dd467ddb20e1f120576dc34cf1585dc095fe2ac054d787d23dc23ac9606a35a2
User & Date: js on 2017-10-29 01:41:22
Other Links: manifest | tags
Context
2017-10-29
01:48
Add +[OFFile fileWithURL:mode:] check-in: ec1ec2815d user: js tags: trunk
01:41
OFFileManager: Add URL versions of all methods check-in: dd467ddb20 user: js tags: trunk
00:41
Fix conversion between URL and path on Win32 check-in: b83d1414b1 user: js tags: trunk
Changes

Modified src/OFFileManager.h from [6fbc0773f9] to [a89fad782a].

66
67
68
69
70
71
72








73
74
75
76
77
78
79
80








81
82
83
84
85
86
87
88








89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
















107
108
109
110
111
112
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
171
172
173
174
175













176
177
178
179
180
181
182
183
184
185
186
187
188
189















190
191
192
193
194
195
196
197
198
199
200
201
202
203











204
205
206
207
208
209
210
211
212
213
214











215
216
217
218
219
220
221
222
223
224
225
226













227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
















245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
















261
262
263
264
265
266
267
268
269









270
271
272
273
274
275
276
277
278
279
280
281
282
283














284
285
286
287
288
289
290
 * @brief Checks whether a file exists at the specified path.
 *
 * @param path The path to check
 * @return A boolean whether there is a file at the specified path
 */
- (bool)fileExistsAtPath: (OFString *)path;









/*!
 * @brief Checks whether a directory exists at the specified path.
 *
 * @param path The path to check
 * @return A boolean whether there is a directory at the specified path
 */
- (bool)directoryExistsAtPath: (OFString *)path;









#ifdef OF_FILE_MANAGER_SUPPORTS_SYMLINKS
/*!
 * @brief Checks whether a symbolic link exists at the specified path.
 *
 * @param path The path to check
 * @return A boolean whether there is a symbolic link at the specified path
 */
- (bool)symbolicLinkExistsAtPath: (OFString *)path;








#endif

/*!
 * @brief Creates a directory at the specified path.
 *
 * @param path The path of the directory to create
 */
- (void)createDirectoryAtPath: (OFString *)path;

/*!
 * @brief Creates a directory at the specified path.
 *
 * @param path The path of the directory to create
 * @param createParents Whether to create the parents of the directory
 */
- (void)createDirectoryAtPath: (OFString *)path
		createParents: (bool)createParents;

















/*!
 * @brief Returns an array with the items in the specified directory.
 *
 * @note `.` and `..` are not part of the returned array.
 *
 * @param path The path to the directory whose items should be returned
 * @return An array of OFString with the items in the specified directory
 */
- (OFArray OF_GENERIC(OFString *) *)contentsOfDirectoryAtPath: (OFString *)path;











/*!
 * @brief Changes the current working directory.
 *
 * @param path The new directory to change to
 */
- (void)changeCurrentDirectoryPath: (OFString *)path;








/*!
 * @brief Returns the size of the specified file.
 *
 * @param path The path to the file whose size should be returned
 *
 * @return The size of the specified file
 */
- (of_offset_t)sizeOfFileAtPath: (OFString *)path;










/*!
 * @brief Returns the last access time of the specified item.
 *
 * @param path The path to the item whose last access time should be returned
 *
 * @return The last access time of the specified item
 */
- (OFDate *)accessTimeOfItemAtPath: (OFString *)path;










/*!
 * @brief Returns the last modification date of the specified item.
 *
 * @param path The path to the item whose last modification date should be
 *	       returned
 *
 * @return The last modification date of the specified item
 */
- (OFDate *)modificationDateOfItemAtPath: (OFString *)path;











/*!
 * @brief Returns the last status change time of the specified item.
 *
 * @param path The path to the item whose last status change time should be
 *	       returned
 *
 * @return The last status change time of the specified item
 */
- (OFDate *)statusChangeTimeOfItemAtPath: (OFString *)path;











#ifdef OF_FILE_MANAGER_SUPPORTS_PERMISSIONS
/*!
 * @brief Returns the permissions of the specified item.
 *
 * This returns only the permissions, meaning read, write and execute for
 * owner, user and group, along with the sticky, setuid and setgid bit. In
 * other words, only bits that match the mask 07777.
 *
 * @param path The path to the item whose permissions should be returned
 *
 * @return The permissions of the specified item
 */
- (uint16_t)permissionsOfItemAtPath: (OFString *)path;














/*!
 * @brief Changes the permissions of an item.
 *
 * This only changes the permissions, meaning read, write and execute for
 * owner, user and group. For security reasons, it ignores all other bits. In
 * other words, the permissions are masked with 0777.
 *
 * This method only changes the read-only flag on Windows.
 *
 * @param path The path to the item whose permissions should be changed
 * @param permissions The new permissions for the item
 */
- (void)changePermissionsOfItemAtPath: (OFString *)path
			  permissions: (uint16_t)permissions;















#endif

#ifdef OF_FILE_MANAGER_SUPPORTS_OWNER
/*!
 * @brief Get the UID and GID of the specified item.
 *
 * @param UID A pointer to an uint16_t to store the UID, or NULL
 * @param GID A pointer to an uint16_t to store the GID, or NULL
 * @param path The path to the item whose UID and GID should be retrieved
 */
- (void)getUID: (nullable uint16_t *)UID
	   GID: (nullable uint16_t *)GID
  ofItemAtPath: (OFString *)path;












/*!
 * @brief Get the owner and group of the specified item.
 *
 * @param owner A pointer to an `OFString *` to store the owner, or NULL
 * @param group A pointer to an `OFString *` to store the group, or NULL
 * @param path The path to the item whose owner and group should be retrieved
 */
- (void)getOwner: (OFString *__autoreleasing _Nonnull *_Nullable)owner
	   group: (OFString *__autoreleasing _Nonnull *_Nullable)group
    ofItemAtPath: (OFString *)path;












/*!
 * @brief Changes the owner of an item.
 *
 * This method is not available on some systems, most notably Windows.
 *
 * @param path The path to the item whose owner should be changed
 * @param owner The new owner for the item
 * @param group The new group for the item
 */
- (void)changeOwnerOfItemAtPath: (OFString *)path
			  owner: (OFString *)owner
			  group: (OFString *)group;













#endif

/*!
 * @brief Copies a file, directory or symlink (if supported by the OS).
 *
 * The destination path must be a full path, which means it must include the
 * name of the item.
 *
 * If an item already exists, the copy operation fails. This is also the case
 * if a directory is copied and an item already exists in the destination
 * directory.
 *
 * @param source The file, directory or symlink to copy
 * @param destination The destination path
 */
- (void)copyItemAtPath: (OFString *)source
		toPath: (OFString *)destination;

















/*!
 * @brief Moves an item.
 *
 * The destination path must be a full path, which means it must include the
 * name of the item.
 *
 * If the destination is on a different logical device, the source will be
 * copied to the destination using @ref copyItemAtPath:toPath: and the source
 * removed using @ref removeItemAtPath:.
 *
 * @param source The item to rename
 * @param destination The new name for the item
 */
- (void)moveItemAtPath: (OFString *)source
		toPath: (OFString *)destination;

















/*!
 * @brief Removes the item at the specified path.
 *
 * If the item at the specified path is a directory, it is removed recursively.
 *
 * @param path The path to the item which should be removed
 */
- (void)removeItemAtPath: (OFString *)path;










#ifdef OF_FILE_MANAGER_SUPPORTS_LINKS
/*!
 * @brief Creates a hard link for the specified item.
 *
 * The destination path must be a full path, which means it must include the
 * name of the item.
 *
 * This method is not available on some systems.
 *
 * @param source The path to the item for which a link should be created
 * @param destination The path to the item which should link to the source
 */
- (void)linkItemAtPath: (OFString *)source
		toPath: (OFString *)destination;














#endif

#ifdef OF_FILE_MANAGER_SUPPORTS_SYMLINKS
/*!
 * @brief Creates a symbolic link for an item.
 *
 * The destination path must be a full path, which means it must include the







>
>
>
>
>
>
>
>








>
>
>
>
>
>
>
>








>
>
>
>
>
>
>
>


















>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>










>
>
>
>
>
>
>
>
>
>







>
>
>
>
>
>
>









>
>
>
>
>
>
>
>
>









>
>
>
>
>
>
>
>
>










>
>
>
>
>
>
>
>
>
>










>
>
>
>
>
>
>
>
>
>














>
>
>
>
>
>
>
>
>
>
>
>
>














>
>
>
>
>
>
>
>
>
>
>
>
>
>
>














>
>
>
>
>
>
>
>
>
>
>











>
>
>
>
>
>
>
>
>
>
>












>
>
>
>
>
>
>
>
>
>
>
>
>


















>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
















>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>









>
>
>
>
>
>
>
>
>














>
>
>
>
>
>
>
>
>
>
>
>
>
>







66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
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
377
378
379
380
381
382
383
384
385
386
387
388
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
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
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
 * @brief Checks whether a file exists at the specified path.
 *
 * @param path The path to check
 * @return A boolean whether there is a file at the specified path
 */
- (bool)fileExistsAtPath: (OFString *)path;

/*!
 * @brief Checks whether a file exists at the specified URL.
 *
 * @param URL The URL to check
 * @return A boolean whether there is a file at the specified URL
 */
- (bool)fileExistsAtURL: (OFURL *)URL;

/*!
 * @brief Checks whether a directory exists at the specified path.
 *
 * @param path The path to check
 * @return A boolean whether there is a directory at the specified path
 */
- (bool)directoryExistsAtPath: (OFString *)path;

/*!
 * @brief Checks whether a directory exists at the specified URL.
 *
 * @param URL The URL to check
 * @return A boolean whether there is a directory at the specified URL
 */
- (bool)directoryExistsAtURL: (OFURL *)URL;

#ifdef OF_FILE_MANAGER_SUPPORTS_SYMLINKS
/*!
 * @brief Checks whether a symbolic link exists at the specified path.
 *
 * @param path The path to check
 * @return A boolean whether there is a symbolic link at the specified path
 */
- (bool)symbolicLinkExistsAtPath: (OFString *)path;

/*!
 * @brief Checks whether a symbolic link exists at the specified URL.
 *
 * @param URL The URL to check
 * @return A boolean whether there is a symbolic link at the specified URL
 */
- (bool)symbolicLinkExistsAtURL: (OFURL *)URL;
#endif

/*!
 * @brief Creates a directory at the specified path.
 *
 * @param path The path of the directory to create
 */
- (void)createDirectoryAtPath: (OFString *)path;

/*!
 * @brief Creates a directory at the specified path.
 *
 * @param path The path of the directory to create
 * @param createParents Whether to create the parents of the directory
 */
- (void)createDirectoryAtPath: (OFString *)path
		createParents: (bool)createParents;

/*!
 * @brief Creates a directory at the specified URL.
 *
 * @param URL The URL of the directory to create
 */
- (void)createDirectoryAtURL: (OFURL *)URL;

/*!
 * @brief Creates a directory at the specified URL.
 *
 * @param URL The URL of the directory to create
 * @param createParents Whether to create the parents of the directory
 */
- (void)createDirectoryAtURL: (OFURL *)URL
	       createParents: (bool)createParents;

/*!
 * @brief Returns an array with the items in the specified directory.
 *
 * @note `.` and `..` are not part of the returned array.
 *
 * @param path The path to the directory whose items should be returned
 * @return An array of OFString with the items in the specified directory
 */
- (OFArray OF_GENERIC(OFString *) *)contentsOfDirectoryAtPath: (OFString *)path;

/*!
 * @brief Returns an array with the items in the specified directory.
 *
 * @note `.` and `..` are not part of the returned array.
 *
 * @param URL The URL to the directory whose items should be returned
 * @return An array of OFString with the items in the specified directory
 */
- (OFArray OF_GENERIC(OFString *) *)contentsOfDirectoryAtURL: (OFURL *)URL;

/*!
 * @brief Changes the current working directory.
 *
 * @param path The new directory to change to
 */
- (void)changeCurrentDirectoryPath: (OFString *)path;

/*!
 * @brief Changes the current working directory.
 *
 * @param URL The new directory to change to
 */
- (void)changeCurrentDirectoryURL: (OFURL *)URL;

/*!
 * @brief Returns the size of the specified file.
 *
 * @param path The path to the file whose size should be returned
 *
 * @return The size of the specified file
 */
- (of_offset_t)sizeOfFileAtPath: (OFString *)path;

/*!
 * @brief Returns the size of the specified file.
 *
 * @param URL The URL to the file whose size should be returned
 *
 * @return The size of the specified file
 */
- (of_offset_t)sizeOfFileAtURL: (OFURL *)URL;

/*!
 * @brief Returns the last access time of the specified item.
 *
 * @param path The path to the item whose last access time should be returned
 *
 * @return The last access time of the specified item
 */
- (OFDate *)accessTimeOfItemAtPath: (OFString *)path;

/*!
 * @brief Returns the last access time of the specified item.
 *
 * @param URL The URL to the item whose last access time should be returned
 *
 * @return The last access time of the specified item
 */
- (OFDate *)accessTimeOfItemAtURL: (OFURL *)URL;

/*!
 * @brief Returns the last modification date of the specified item.
 *
 * @param path The path to the item whose last modification date should be
 *	       returned
 *
 * @return The last modification date of the specified item
 */
- (OFDate *)modificationDateOfItemAtPath: (OFString *)path;

/*!
 * @brief Returns the last modification date of the specified item.
 *
 * @param URL The URL to the item whose last modification date should be
 *	       returned
 *
 * @return The last modification date of the specified item
 */
- (OFDate *)modificationDateOfItemAtURL: (OFURL *)URL;

/*!
 * @brief Returns the last status change time of the specified item.
 *
 * @param path The path to the item whose last status change time should be
 *	       returned
 *
 * @return The last status change time of the specified item
 */
- (OFDate *)statusChangeTimeOfItemAtPath: (OFString *)path;

/*!
 * @brief Returns the last status change time of the specified item.
 *
 * @param URL The URL to the item whose last status change time should be
 *	      returned
 *
 * @return The last status change time of the specified item
 */
- (OFDate *)statusChangeTimeOfItemAtURL: (OFURL *)URL;

#ifdef OF_FILE_MANAGER_SUPPORTS_PERMISSIONS
/*!
 * @brief Returns the permissions of the specified item.
 *
 * This returns only the permissions, meaning read, write and execute for
 * owner, user and group, along with the sticky, setuid and setgid bit. In
 * other words, only bits that match the mask 07777.
 *
 * @param path The path to the item whose permissions should be returned
 *
 * @return The permissions of the specified item
 */
- (uint16_t)permissionsOfItemAtPath: (OFString *)path;

/*!
 * @brief Returns the permissions of the specified item.
 *
 * This returns only the permissions, meaning read, write and execute for
 * owner, user and group, along with the sticky, setuid and setgid bit. In
 * other words, only bits that match the mask 07777.
 *
 * @param URL The URL to the item whose permissions should be returned
 *
 * @return The permissions of the specified item
 */
- (uint16_t)permissionsOfItemAtURL: (OFURL *)URL;

/*!
 * @brief Changes the permissions of an item.
 *
 * This only changes the permissions, meaning read, write and execute for
 * owner, user and group. For security reasons, it ignores all other bits. In
 * other words, the permissions are masked with 0777.
 *
 * This method only changes the read-only flag on Windows.
 *
 * @param path The path to the item whose permissions should be changed
 * @param permissions The new permissions for the item
 */
- (void)changePermissionsOfItemAtPath: (OFString *)path
			  permissions: (uint16_t)permissions;

/*!
 * @brief Changes the permissions of an item.
 *
 * This only changes the permissions, meaning read, write and execute for
 * owner, user and group. For security reasons, it ignores all other bits. In
 * other words, the permissions are masked with 0777.
 *
 * This method only changes the read-only flag on Windows.
 *
 * @param URL The URL to the item whose permissions should be changed
 * @param permissions The new permissions for the item
 */
- (void)changePermissionsOfItemAtURL: (OFURL *)URL
			 permissions: (uint16_t)permissions;
#endif

#ifdef OF_FILE_MANAGER_SUPPORTS_OWNER
/*!
 * @brief Get the UID and GID of the specified item.
 *
 * @param UID A pointer to an uint16_t to store the UID, or NULL
 * @param GID A pointer to an uint16_t to store the GID, or NULL
 * @param path The path to the item whose UID and GID should be retrieved
 */
- (void)getUID: (nullable uint16_t *)UID
	   GID: (nullable uint16_t *)GID
  ofItemAtPath: (OFString *)path;

/*!
 * @brief Get the UID and GID of the specified item.
 *
 * @param UID A pointer to an uint16_t to store the UID, or NULL
 * @param GID A pointer to an uint16_t to store the GID, or NULL
 * @param URL The URL to the item whose UID and GID should be retrieved
 */
- (void)getUID: (nullable uint16_t *)UID
	   GID: (nullable uint16_t *)GID
   ofItemAtURL: (OFURL *)URL;

/*!
 * @brief Get the owner and group of the specified item.
 *
 * @param owner A pointer to an `OFString *` to store the owner, or NULL
 * @param group A pointer to an `OFString *` to store the group, or NULL
 * @param path The path to the item whose owner and group should be retrieved
 */
- (void)getOwner: (OFString *__autoreleasing _Nonnull *_Nullable)owner
	   group: (OFString *__autoreleasing _Nonnull *_Nullable)group
    ofItemAtPath: (OFString *)path;

/*!
 * @brief Get the owner and group of the specified item.
 *
 * @param owner A pointer to an `OFString *` to store the owner, or NULL
 * @param group A pointer to an `OFString *` to store the group, or NULL
 * @param URL The URL to the item whose owner and group should be retrieved
 */
- (void)getOwner: (OFString *__autoreleasing _Nonnull *_Nullable)owner
	   group: (OFString *__autoreleasing _Nonnull *_Nullable)group
     ofItemAtURL: (OFURL *)URL;

/*!
 * @brief Changes the owner of an item.
 *
 * This method is not available on some systems, most notably Windows.
 *
 * @param path The path to the item whose owner should be changed
 * @param owner The new owner for the item
 * @param group The new group for the item
 */
- (void)changeOwnerOfItemAtPath: (OFString *)path
			  owner: (OFString *)owner
			  group: (OFString *)group;

/*!
 * @brief Changes the owner of an item.
 *
 * This method is not available on some systems, most notably Windows.
 *
 * @param URL The URL to the item whose owner should be changed
 * @param owner The new owner for the item
 * @param group The new group for the item
 */
- (void)changeOwnerOfItemAtURL: (OFURL *)URL
			 owner: (OFString *)owner
			 group: (OFString *)group;
#endif

/*!
 * @brief Copies a file, directory or symlink (if supported by the OS).
 *
 * The destination path must be a full path, which means it must include the
 * name of the item.
 *
 * If an item already exists, the copy operation fails. This is also the case
 * if a directory is copied and an item already exists in the destination
 * directory.
 *
 * @param source The file, directory or symlink to copy
 * @param destination The destination path
 */
- (void)copyItemAtPath: (OFString *)source
		toPath: (OFString *)destination;

/*!
 * @brief Copies a file, directory or symlink (if supported by the OS).
 *
 * The destination URL must have a full path, which means it must include the
 * name of the item.
 *
 * If an item already exists, the copy operation fails. This is also the case
 * if a directory is copied and an item already exists in the destination
 * directory.
 *
 * @param source The file, directory or symlink to copy
 * @param destination The destination URL
 */
- (void)copyItemAtURL: (OFURL *)source
		toURL: (OFURL *)destination;

/*!
 * @brief Moves an item.
 *
 * The destination path must be a full path, which means it must include the
 * name of the item.
 *
 * If the destination is on a different logical device, the source will be
 * copied to the destination using @ref copyItemAtPath:toPath: and the source
 * removed using @ref removeItemAtPath:.
 *
 * @param source The item to rename
 * @param destination The new name for the item
 */
- (void)moveItemAtPath: (OFString *)source
		toPath: (OFString *)destination;

/*!
 * @brief Moves an item.
 *
 * The destination URL must have a full path, which means it must include the
 * name of the item.
 *
 * If the destination is on a different logical device, the source will be
 * copied to the destination using @ref copyItemAtURL:toURL: and the source
 * removed using @ref removeItemAtURL:.
 *
 * @param source The item to rename
 * @param destination The new name for the item
 */
- (void)moveItemAtURL: (OFURL *)source
		toURL: (OFURL *)destination;

/*!
 * @brief Removes the item at the specified path.
 *
 * If the item at the specified path is a directory, it is removed recursively.
 *
 * @param path The path to the item which should be removed
 */
- (void)removeItemAtPath: (OFString *)path;

/*!
 * @brief Removes the item at the specified URL.
 *
 * If the item at the specified URL is a directory, it is removed recursively.
 *
 * @param URL The URL to the item which should be removed
 */
- (void)removeItemAtURL: (OFURL *)URL;

#ifdef OF_FILE_MANAGER_SUPPORTS_LINKS
/*!
 * @brief Creates a hard link for the specified item.
 *
 * The destination path must be a full path, which means it must include the
 * name of the item.
 *
 * This method is not available on some systems.
 *
 * @param source The path to the item for which a link should be created
 * @param destination The path to the item which should link to the source
 */
- (void)linkItemAtPath: (OFString *)source
		toPath: (OFString *)destination;

/*!
 * @brief Creates a hard link for the specified item.
 *
 * The destination URL must have a full path, which means it must include the
 * name of the item.
 *
 * This method is not available on some systems.
 *
 * @param source The URL to the item for which a link should be created
 * @param destination The URL to the item which should link to the source
 */
- (void)linkItemAtURL: (OFURL *)source
		toURL: (OFURL *)destination;
#endif

#ifdef OF_FILE_MANAGER_SUPPORTS_SYMLINKS
/*!
 * @brief Creates a symbolic link for an item.
 *
 * The destination path must be a full path, which means it must include the
299
300
301
302
303
304
305



















306
307
308
309
310
311
312
313
314
315











316
317
318
319
 *		      source
 * @param source The path to the item for which a symbolic link should be
 *		 created
 */
- (void)createSymbolicLinkAtPath: (OFString *)destination
	     withDestinationPath: (OFString *)source;




















/*!
 * @brief Returns the destination of the symbolic link at the specified path.
 *
 * @param path The path to the symbolic link
 *
 * @note On Windows, at least Windows Vista is required.
 *
 * @return The destination of the symbolic link at the specified path
 */
- (OFString *)destinationOfSymbolicLinkAtPath: (OFString *)path;











#endif
@end

OF_ASSUME_NONNULL_END







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>










>
>
>
>
>
>
>
>
>
>
>




512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
 *		      source
 * @param source The path to the item for which a symbolic link should be
 *		 created
 */
- (void)createSymbolicLinkAtPath: (OFString *)destination
	     withDestinationPath: (OFString *)source;

/*!
 * @brief Creates a symbolic link for an item.
 *
 * The destination uRL must have a full path, which means it must include the
 * name of the item.
 *
 * This method is not available on some systems.
 *
 * @note On Windows, this requires at least Windows Vista and administrator
 *	 privileges!
 *
 * @param destination The URL to the item which should symbolically link to the
 *		      source
 * @param source The URL to the item for which a symbolic link should be
 *		 created
 */
- (void)createSymbolicLinkAtURL: (OFURL *)destination
	     withDestinationURL: (OFURL *)source;

/*!
 * @brief Returns the destination of the symbolic link at the specified path.
 *
 * @param path The path to the symbolic link
 *
 * @note On Windows, at least Windows Vista is required.
 *
 * @return The destination of the symbolic link at the specified path
 */
- (OFString *)destinationOfSymbolicLinkAtPath: (OFString *)path;

/*!
 * @brief Returns the destination of the symbolic link at the specified URL.
 *
 * @param URL The URL to the symbolic link
 *
 * @note On Windows, at least Windows Vista is required.
 *
 * @return The destination of the symbolic link at the specified URL
 */
- (OFString *)destinationOfSymbolicLinkAtURL: (OFURL *)URL;
#endif
@end

OF_ASSUME_NONNULL_END

Modified src/OFFileManager.m from [c6f7e83a5a] to [a4a8182fdb].

323
324
325
326
327
328
329










330
331
332
333
334
335
336
337
338
339
340
341
342










343
344
345
346
347
348
349
		@throw [OFInvalidArgumentException exception];

	if (of_stat(path, &s) == -1)
		return false;

	return S_ISREG(s.st_mode);
}











- (bool)directoryExistsAtPath: (OFString *)path
{
	of_stat_t s;

	if (path == nil)
		@throw [OFInvalidArgumentException exception];

	if (of_stat(path, &s) == -1)
		return false;

	return S_ISDIR(s.st_mode);
}











#ifdef OF_FILE_MANAGER_SUPPORTS_SYMLINKS
- (bool)symbolicLinkExistsAtPath: (OFString *)path
{
# ifndef OF_WINDOWS
	of_stat_t s;








>
>
>
>
>
>
>
>
>
>













>
>
>
>
>
>
>
>
>
>







323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
		@throw [OFInvalidArgumentException exception];

	if (of_stat(path, &s) == -1)
		return false;

	return S_ISREG(s.st_mode);
}

- (bool)fileExistsAtURL: (OFURL *)URL
{
	void *pool = objc_autoreleasePoolPush();
	bool ret = [self fileExistsAtPath: [URL fileSystemRepresentation]];

	objc_autoreleasePoolPop(pool);

	return ret;
}

- (bool)directoryExistsAtPath: (OFString *)path
{
	of_stat_t s;

	if (path == nil)
		@throw [OFInvalidArgumentException exception];

	if (of_stat(path, &s) == -1)
		return false;

	return S_ISDIR(s.st_mode);
}

- (bool)directoryExistsAtURL: (OFURL *)URL
{
	void *pool = objc_autoreleasePoolPush();
	bool ret = [self directoryExistsAtPath: [URL fileSystemRepresentation]];

	objc_autoreleasePoolPop(pool);

	return ret;
}

#ifdef OF_FILE_MANAGER_SUPPORTS_SYMLINKS
- (bool)symbolicLinkExistsAtPath: (OFString *)path
{
# ifndef OF_WINDOWS
	of_stat_t s;

363
364
365
366
367
368
369











370
371
372
373
374
375
376
	if ((data.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) &&
	    data.dwReserved0 == IO_REPARSE_TAG_SYMLINK)
		return true;

	return false;
# endif
}











#endif

- (void)createDirectoryAtPath: (OFString *)path
{
	if (path == nil)
		@throw [OFInvalidArgumentException exception];








>
>
>
>
>
>
>
>
>
>
>







383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
	if ((data.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) &&
	    data.dwReserved0 == IO_REPARSE_TAG_SYMLINK)
		return true;

	return false;
# endif
}

- (bool)symbolicLinkExistsAtURL: (OFURL *)URL
{
	void *pool = objc_autoreleasePoolPush();
	bool ret = [self symbolicLinkExistsAtPath:
	    [URL fileSystemRepresentation]];

	objc_autoreleasePoolPop(pool);

	return ret;
}
#endif

- (void)createDirectoryAtPath: (OFString *)path
{
	if (path == nil)
		@throw [OFInvalidArgumentException exception];

453
454
455
456
457
458
459




















460
461
462
463
464
465
466
		[currentPath retain];

		objc_autoreleasePoolPop(pool);

		[currentPath autorelease];
	}
}





















- (OFArray *)contentsOfDirectoryAtPath: (OFString *)path
{
	OFMutableArray *files;

	if (path == nil)
		@throw [OFInvalidArgumentException exception];







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
		[currentPath retain];

		objc_autoreleasePoolPop(pool);

		[currentPath autorelease];
	}
}

- (void)createDirectoryAtURL: (OFURL *)URL
{
	void *pool = objc_autoreleasePoolPush();

	[self createDirectoryAtPath: [URL fileSystemRepresentation]];

	objc_autoreleasePoolPop(pool);
}

- (void)createDirectoryAtURL: (OFURL *)URL
	       createParents: (bool)createParents
{
	void *pool = objc_autoreleasePoolPush();

	[self createDirectoryAtPath: [URL fileSystemRepresentation]
		      createParents: createParents];

	objc_autoreleasePoolPop(pool);
}

- (OFArray *)contentsOfDirectoryAtPath: (OFString *)path
{
	OFMutableArray *files;

	if (path == nil)
		@throw [OFInvalidArgumentException exception];
634
635
636
637
638
639
640













641
642
643
644
645
646
647
	}
#endif

	[files makeImmutable];

	return files;
}














- (void)changeCurrentDirectoryPath: (OFString *)path
{
	if (path == nil)
		@throw [OFInvalidArgumentException exception];

#if defined(OF_WINDOWS)







>
>
>
>
>
>
>
>
>
>
>
>
>







685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
	}
#endif

	[files makeImmutable];

	return files;
}

- (OFArray *)contentsOfDirectoryAtURL: (OFURL *)URL
{
	void *pool = objc_autoreleasePoolPush();
	OFArray *ret = [self contentsOfDirectoryAtPath:
	    [URL fileSystemRepresentation]];

	[ret retain];

	objc_autoreleasePoolPop(pool);

	return [ret autorelease];
}

- (void)changeCurrentDirectoryPath: (OFString *)path
{
	if (path == nil)
		@throw [OFInvalidArgumentException exception];

#if defined(OF_WINDOWS)
685
686
687
688
689
690
691









692
693
694
695
696
697
698
699
700
701
702
703
704
705











706
707
708
709
710
711
712
713
714
715
716
717
718
719
720













721
722
723
724
725
726
727
728
729
730
731
732
733
734
735













736
737
738
739
740
741
742
743
744
745
746
747
748
749
750













751
752
753
754
755
756
757
758
759
760
761
762
763
764
765











766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785











786
787
788
789
790
791
792
#else
	if (chdir([path cStringWithEncoding: [OFLocalization encoding]]) != 0)
		@throw [OFChangeCurrentDirectoryPathFailedException
		    exceptionWithPath: path
				errNo: errno];
#endif
}










- (of_offset_t)sizeOfFileAtPath: (OFString *)path
{
	of_stat_t s;

	if (path == nil)
		@throw [OFInvalidArgumentException exception];

	if (of_stat(path, &s) != 0)
		@throw [OFStatItemFailedException exceptionWithPath: path
							      errNo: errno];

	return s.st_size;
}












- (OFDate *)accessTimeOfItemAtPath: (OFString *)path
{
	of_stat_t s;

	if (path == nil)
		@throw [OFInvalidArgumentException exception];

	if (of_stat(path, &s) != 0)
		@throw [OFStatItemFailedException exceptionWithPath: path
							      errNo: errno];

	/* FIXME: We could be more precise on some OSes */
	return [OFDate dateWithTimeIntervalSince1970: s.st_atime];
}














- (OFDate *)modificationDateOfItemAtPath: (OFString *)path
{
	of_stat_t s;

	if (path == nil)
		@throw [OFInvalidArgumentException exception];

	if (of_stat(path, &s) != 0)
		@throw [OFStatItemFailedException exceptionWithPath: path
							      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)
		@throw [OFStatItemFailedException exceptionWithPath: path
							      errNo: errno];

	/* FIXME: We could be more precise on some OSes */
	return [OFDate dateWithTimeIntervalSince1970: s.st_ctime];
}














#ifdef OF_FILE_MANAGER_SUPPORTS_PERMISSIONS
- (uint16_t)permissionsOfItemAtPath: (OFString *)path
{
	of_stat_t s;

	if (path == nil)
		@throw [OFInvalidArgumentException exception];

	if (of_stat(path, &s) != 0)
		@throw [OFStatItemFailedException exceptionWithPath: path
							      errNo: errno];

	return s.st_mode & 07777;
}












- (void)changePermissionsOfItemAtPath: (OFString *)path
			  permissions: (uint16_t)permissions
{
	if (path == nil)
		@throw [OFInvalidArgumentException exception];

	permissions &= 0777;

# ifndef OF_WINDOWS
	if (chmod([path cStringWithEncoding: [OFLocalization encoding]],
	    permissions) != 0)
# else
	if (_wchmod([path UTF16String], permissions) != 0)
# endif
		@throw [OFChangePermissionsFailedException
		    exceptionWithPath: path
			  permissions: permissions
				errNo: errno];
}











#endif

#ifdef OF_FILE_MANAGER_SUPPORTS_OWNER
- (void)getUID: (uint16_t *)UID
	   GID: (uint16_t *)GID
  ofItemAtPath: (OFString *)path
{







>
>
>
>
>
>
>
>
>














>
>
>
>
>
>
>
>
>
>
>















>
>
>
>
>
>
>
>
>
>
>
>
>















>
>
>
>
>
>
>
>
>
>
>
>
>















>
>
>
>
>
>
>
>
>
>
>
>
>















>
>
>
>
>
>
>
>
>
>
>




















>
>
>
>
>
>
>
>
>
>
>







749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
#else
	if (chdir([path cStringWithEncoding: [OFLocalization encoding]]) != 0)
		@throw [OFChangeCurrentDirectoryPathFailedException
		    exceptionWithPath: path
				errNo: errno];
#endif
}

- (void)changeCurrentDirectoryURL: (OFURL *)URL
{
	void *pool = objc_autoreleasePoolPush();

	[self changeCurrentDirectoryPath: [URL fileSystemRepresentation]];

	objc_autoreleasePoolPop(pool);
}

- (of_offset_t)sizeOfFileAtPath: (OFString *)path
{
	of_stat_t s;

	if (path == nil)
		@throw [OFInvalidArgumentException exception];

	if (of_stat(path, &s) != 0)
		@throw [OFStatItemFailedException exceptionWithPath: path
							      errNo: errno];

	return s.st_size;
}

- (of_offset_t)sizeOfFileAtURL: (OFURL *)URL
{
	void *pool = objc_autoreleasePoolPush();
	of_offset_t ret = [self sizeOfFileAtPath:
	    [URL fileSystemRepresentation]];

	objc_autoreleasePoolPop(pool);

	return ret;
}

- (OFDate *)accessTimeOfItemAtPath: (OFString *)path
{
	of_stat_t s;

	if (path == nil)
		@throw [OFInvalidArgumentException exception];

	if (of_stat(path, &s) != 0)
		@throw [OFStatItemFailedException exceptionWithPath: path
							      errNo: errno];

	/* FIXME: We could be more precise on some OSes */
	return [OFDate dateWithTimeIntervalSince1970: s.st_atime];
}

- (OFDate *)accessTimeOfItemAtURL: (OFURL *)URL
{
	void *pool = objc_autoreleasePoolPush();
	OFDate *ret = [self accessTimeOfItemAtPath:
	    [URL fileSystemRepresentation]];

	[ret retain];

	objc_autoreleasePoolPop(pool);

	return [ret autorelease];
}

- (OFDate *)modificationDateOfItemAtPath: (OFString *)path
{
	of_stat_t s;

	if (path == nil)
		@throw [OFInvalidArgumentException exception];

	if (of_stat(path, &s) != 0)
		@throw [OFStatItemFailedException exceptionWithPath: path
							      errNo: errno];

	/* FIXME: We could be more precise on some OSes */
	return [OFDate dateWithTimeIntervalSince1970: s.st_mtime];
}

- (OFDate *)modificationDateOfItemAtURL: (OFURL *)URL
{
	void *pool = objc_autoreleasePoolPush();
	OFDate *ret = [self modificationDateOfItemAtPath:
	    [URL fileSystemRepresentation]];

	[ret retain];

	objc_autoreleasePoolPop(pool);

	return [ret autorelease];
}

- (OFDate *)statusChangeTimeOfItemAtPath: (OFString *)path
{
	of_stat_t s;

	if (path == nil)
		@throw [OFInvalidArgumentException exception];

	if (of_stat(path, &s) != 0)
		@throw [OFStatItemFailedException exceptionWithPath: path
							      errNo: errno];

	/* FIXME: We could be more precise on some OSes */
	return [OFDate dateWithTimeIntervalSince1970: s.st_ctime];
}

- (OFDate *)statusChangeTimeOfItemAtURL: (OFURL *)URL
{
	void *pool = objc_autoreleasePoolPush();
	OFDate *ret = [self statusChangeTimeOfItemAtPath:
	    [URL fileSystemRepresentation]];

	[ret retain];

	objc_autoreleasePoolPop(pool);

	return [ret autorelease];
}

#ifdef OF_FILE_MANAGER_SUPPORTS_PERMISSIONS
- (uint16_t)permissionsOfItemAtPath: (OFString *)path
{
	of_stat_t s;

	if (path == nil)
		@throw [OFInvalidArgumentException exception];

	if (of_stat(path, &s) != 0)
		@throw [OFStatItemFailedException exceptionWithPath: path
							      errNo: errno];

	return s.st_mode & 07777;
}

- (uint16_t)permissionsOfItemAtURL: (OFURL *)URL
{
	void *pool = objc_autoreleasePoolPush();
	uint16_t ret = [self permissionsOfItemAtPath:
	    [URL fileSystemRepresentation]];

	objc_autoreleasePoolPop(pool);

	return ret;
}

- (void)changePermissionsOfItemAtPath: (OFString *)path
			  permissions: (uint16_t)permissions
{
	if (path == nil)
		@throw [OFInvalidArgumentException exception];

	permissions &= 0777;

# ifndef OF_WINDOWS
	if (chmod([path cStringWithEncoding: [OFLocalization encoding]],
	    permissions) != 0)
# else
	if (_wchmod([path UTF16String], permissions) != 0)
# endif
		@throw [OFChangePermissionsFailedException
		    exceptionWithPath: path
			  permissions: permissions
				errNo: errno];
}

- (void)changePermissionsOfItemAtURL: (OFURL *)URL
			 permissions: (uint16_t)permissions
{
	void *pool = objc_autoreleasePoolPush();

	[self changePermissionsOfItemAtPath: [URL fileSystemRepresentation]
				permissions: permissions];

	objc_autoreleasePoolPop(pool);
}
#endif

#ifdef OF_FILE_MANAGER_SUPPORTS_OWNER
- (void)getUID: (uint16_t *)UID
	   GID: (uint16_t *)GID
  ofItemAtPath: (OFString *)path
{
800
801
802
803
804
805
806













807
808
809
810
811
812
813
							      errNo: errno];

	if (UID != NULL)
		*UID = s.st_uid;
	if (GID != NULL)
		*GID = s.st_gid;
}














- (void)getOwner: (OFString **)owner
	   group: (OFString **)group
    ofItemAtPath: (OFString *)path
{
	uint16_t UID, GID;








>
>
>
>
>
>
>
>
>
>
>
>
>







945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
							      errNo: errno];

	if (UID != NULL)
		*UID = s.st_uid;
	if (GID != NULL)
		*GID = s.st_gid;
}

- (void)getUID: (uint16_t *)UID
	   GID: (uint16_t *)GID
   ofItemAtURL: (OFURL *)URL
{
	void *pool = objc_autoreleasePoolPush();

	[self	  getUID: UID
		     GID: GID
	    ofItemAtPath: [URL fileSystemRepresentation]];

	objc_autoreleasePoolPop(pool);
}

- (void)getOwner: (OFString **)owner
	   group: (OFString **)group
    ofItemAtPath: (OFString *)path
{
	uint16_t UID, GID;

836
837
838
839
840
841
842




















843
844
845
846
847
848
849
		}
# ifdef OF_HAVE_THREADS
	} @finally {
		[passwdMutex unlock];
	}
# endif
}





















- (void)changeOwnerOfItemAtPath: (OFString *)path
			  owner: (OFString *)owner
			  group: (OFString *)group
{
	uid_t uid = -1;
	gid_t gid = -1;







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
		}
# ifdef OF_HAVE_THREADS
	} @finally {
		[passwdMutex unlock];
	}
# endif
}

- (void)getOwner: (OFString **)owner
	   group: (OFString **)group
     ofItemAtURL: (OFURL *)URL
{
	void *pool = objc_autoreleasePoolPush();
	OFString *path = [URL fileSystemRepresentation];

	[path retain];

	objc_autoreleasePoolPop(pool);

	@try {
		[self   getOwner: owner
			   group: group
		    ofItemAtPath: path];
	} @finally {
		[path release];
	}
}

- (void)changeOwnerOfItemAtPath: (OFString *)path
			  owner: (OFString *)owner
			  group: (OFString *)group
{
	uid_t uid = -1;
	gid_t gid = -1;
893
894
895
896
897
898
899













900
901
902
903
904
905
906

	if (chown([path cStringWithEncoding: encoding], uid, gid) != 0)
		@throw [OFChangeOwnerFailedException exceptionWithPath: path
								 owner: owner
								 group: group
								 errNo: errno];
}













#endif

- (void)copyItemAtPath: (OFString *)source
		toPath: (OFString *)destination
{
	void *pool;
	of_stat_t s;







>
>
>
>
>
>
>
>
>
>
>
>
>







1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097

	if (chown([path cStringWithEncoding: encoding], uid, gid) != 0)
		@throw [OFChangeOwnerFailedException exceptionWithPath: path
								 owner: owner
								 group: group
								 errNo: errno];
}

- (void)changeOwnerOfItemAtURL: (OFURL *)URL
			 owner: (OFString *)owner
			 group: (OFString *)group
{
	void *pool = objc_autoreleasePoolPush();

	[self changeOwnerOfItemAtPath: [URL fileSystemRepresentation]
				owner: owner
				group: group];

	objc_autoreleasePoolPop(pool);
}
#endif

- (void)copyItemAtPath: (OFString *)source
		toPath: (OFString *)destination
{
	void *pool;
	of_stat_t s;
1038
1039
1040
1041
1042
1043
1044











1045
1046
1047
1048
1049
1050
1051
		@throw [OFCopyItemFailedException
		    exceptionWithSourcePath: source
			    destinationPath: destination
				      errNo: EINVAL];

	objc_autoreleasePoolPop(pool);
}












- (void)moveItemAtPath: (OFString *)source
		toPath: (OFString *)destination
{
	of_stat_t s;

	if (source == nil || destination == nil)







>
>
>
>
>
>
>
>
>
>
>







1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
		@throw [OFCopyItemFailedException
		    exceptionWithSourcePath: source
			    destinationPath: destination
				      errNo: EINVAL];

	objc_autoreleasePoolPop(pool);
}

- (void)copyItemAtURL: (OFURL *)source
		toURL: (OFURL *)destination
{
	void *pool = objc_autoreleasePoolPush();

	[self copyItemAtPath: [source fileSystemRepresentation]
		      toPath: [destination fileSystemRepresentation]];

	objc_autoreleasePoolPop(pool);
}

- (void)moveItemAtPath: (OFString *)source
		toPath: (OFString *)destination
{
	of_stat_t s;

	if (source == nil || destination == nil)
1134
1135
1136
1137
1138
1139
1140











1141
1142
1143
1144
1145
1146
1147
		}
	}

#ifdef OF_WINDOWS
	objc_autoreleasePoolPop(pool);
#endif
}












- (void)removeItemAtPath: (OFString *)path
{
	void *pool;
	of_stat_t s;

	if (path == nil)







>
>
>
>
>
>
>
>
>
>
>







1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
		}
	}

#ifdef OF_WINDOWS
	objc_autoreleasePoolPop(pool);
#endif
}

- (void)moveItemAtURL: (OFURL *)source
		toURL: (OFURL *)destination
{
	void *pool = objc_autoreleasePoolPush();

	[self moveItemAtPath: [source fileSystemRepresentation]
		      toPath: [destination fileSystemRepresentation]];

	objc_autoreleasePoolPop(pool);
}

- (void)removeItemAtPath: (OFString *)path
{
	void *pool;
	of_stat_t s;

	if (path == nil)
1233
1234
1235
1236
1237
1238
1239









1240
1241
1242
1243
1244
1245
1246
		@throw [OFRemoveItemFailedException exceptionWithPath: path
								errNo: errNo];
	}
#endif

	objc_autoreleasePoolPop(pool);
}










#ifdef OF_FILE_MANAGER_SUPPORTS_LINKS
- (void)linkItemAtPath: (OFString *)source
		toPath: (OFString *)destination
{
	void *pool;








>
>
>
>
>
>
>
>
>







1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
		@throw [OFRemoveItemFailedException exceptionWithPath: path
								errNo: errNo];
	}
#endif

	objc_autoreleasePoolPop(pool);
}

- (void)removeItemAtURL: (OFURL *)URL
{
	void *pool = objc_autoreleasePoolPush();

	[self removeItemAtPath: [URL fileSystemRepresentation]];

	objc_autoreleasePoolPop(pool);
}

#ifdef OF_FILE_MANAGER_SUPPORTS_LINKS
- (void)linkItemAtPath: (OFString *)source
		toPath: (OFString *)destination
{
	void *pool;

1264
1265
1266
1267
1268
1269
1270











1271
1272
1273
1274
1275
1276
1277
		@throw [OFLinkFailedException
		    exceptionWithSourcePath: source
			    destinationPath: destination
				      errNo: 0];

# endif












	objc_autoreleasePoolPop(pool);
}
#endif

#ifdef OF_FILE_MANAGER_SUPPORTS_SYMLINKS
- (void)createSymbolicLinkAtPath: (OFString *)destination
	     withDestinationPath: (OFString *)source







>
>
>
>
>
>
>
>
>
>
>







1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
		@throw [OFLinkFailedException
		    exceptionWithSourcePath: source
			    destinationPath: destination
				      errNo: 0];

# endif

	objc_autoreleasePoolPop(pool);
}

- (void)linkItemAtURL: (OFURL *)source
		toURL: (OFURL *)destination
{
	void *pool = objc_autoreleasePoolPush();

	[self linkItemAtPath: [source fileSystemRepresentation]
		      toPath: [destination fileSystemRepresentation]];

	objc_autoreleasePoolPop(pool);
}
#endif

#ifdef OF_FILE_MANAGER_SUPPORTS_SYMLINKS
- (void)createSymbolicLinkAtPath: (OFString *)destination
	     withDestinationPath: (OFString *)source
1301
1302
1303
1304
1305
1306
1307











1308
1309
1310
1311
1312
1313
1314
	    [source UTF16String], 0))
		@throw [OFCreateSymbolicLinkFailedException
		    exceptionWithSourcePath: source
			    destinationPath: destination
				      errNo: 0];
# endif












	objc_autoreleasePoolPop(pool);
}

- (OFString *)destinationOfSymbolicLinkAtPath: (OFString *)path
{
	if (path == nil)
		@throw [OFInvalidArgumentException exception];







>
>
>
>
>
>
>
>
>
>
>







1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
	    [source UTF16String], 0))
		@throw [OFCreateSymbolicLinkFailedException
		    exceptionWithSourcePath: source
			    destinationPath: destination
				      errNo: 0];
# endif

	objc_autoreleasePoolPop(pool);
}

- (void)createSymbolicLinkAtURL: (OFURL *)destination
	     withDestinationURL: (OFURL *)source
{
	void *pool = objc_autoreleasePoolPush();

	[self createSymbolicLinkAtPath: [destination fileSystemRepresentation]
		   withDestinationPath: [source fileSystemRepresentation]];

	objc_autoreleasePoolPop(pool);
}

- (OFString *)destinationOfSymbolicLinkAtPath: (OFString *)path
{
	if (path == nil)
		@throw [OFInvalidArgumentException exception];
1373
1374
1375
1376
1377
1378
1379













1380
1381
					   sizeof(wchar_t)];
# undef slrb
	} @finally {
		CloseHandle(handle);
	}
# endif
}













#endif
@end







>
>
>
>
>
>
>
>
>
>
>
>
>


1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
					   sizeof(wchar_t)];
# undef slrb
	} @finally {
		CloseHandle(handle);
	}
# endif
}

- (OFString *)destinationOfSymbolicLinkAtURL: (OFURL *)URL
{
	void *pool = objc_autoreleasePoolPush();
	OFString *ret = [self destinationOfSymbolicLinkAtPath:
	    [URL fileSystemRepresentation]];

	[ret retain];

	objc_autoreleasePoolPop(pool);

	return [ret autorelease];
}
#endif
@end