ObjFW  Diff

Differences From Artifact [7f908e12d5]:

To Artifact [72d3417f9d]:


14
15
16
17
18
19
20













21
22
23
24
25
26
27
 * file.
 */

#import "OFObject.h"
#import "OFSeekableStream.h"

OF_ASSUME_NONNULL_BEGIN














@class OFArray OF_GENERIC(ObjectType);
@class OFDate;

/*!
 * @class OFFileManager OFFileManager.h ObjFW/OFFileManager.h
 *







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







14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
 * file.
 */

#import "OFObject.h"
#import "OFSeekableStream.h"

OF_ASSUME_NONNULL_BEGIN

#if defined(OF_HAVE_CHMOD) && !defined(OF_MORPHOS)
# define OF_FILE_MANAGER_SUPPORTS_PERMISSIONS
#endif
#if defined(OF_HAVE_CHOWN) && !defined(OF_MORPHOS)
# define OF_FILE_MANAGER_SUPPORTS_OWNER
#endif
#if (defined(OF_HAVE_LINK) && !defined(OF_MORPHOS)) || defined(OF_WINDOWS)
# define OF_FILE_MANAGER_SUPPORTS_LINKS
#endif
#if (defined(OF_HAVE_SYMLINK) && !defined(OF_MORPHOS)) || defined(OF_WINDOWS)
# define OF_FILE_MANAGER_SUPPORTS_SYMLINKS
#endif

@class OFArray OF_GENERIC(ObjectType);
@class OFDate;

/*!
 * @class OFFileManager OFFileManager.h ObjFW/OFFileManager.h
 *
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
 * @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;

#if defined(OF_HAVE_SYMLINK) || defined(OF_WINDOWS)
/*!
 * @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;







|







66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
 * @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;
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
 * @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_HAVE_CHMOD
/*!
 * @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.
 *







|







147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
 * @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.
 *
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
 * @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_HAVE_CHOWN
/*!
 * @brief Get the owner and group of the specified item.
 *
 * @param owner A pointer to an `OFString *` to store the owner, or nil
 * @param group A pointer to an `OFString *` to store the group, or nil
 * @param path The path to the item whose owner and group should be retrieved
 */







|







177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
 * @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 owner and group of the specified item.
 *
 * @param owner A pointer to an `OFString *` to store the owner, or nil
 * @param group A pointer to an `OFString *` to store the group, or nil
 * @param path The path to the item whose owner and group should be retrieved
 */
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
 *
 * 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;

#if defined(OF_HAVE_LINK) || defined(OF_WINDOWS)
/*!
 * @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

#if defined(OF_HAVE_SYMLINK) || defined(OF_WINDOWS)
/*!
 * @brief Creates a symbolic link for an 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.
 *
 * @note On Windows, this requires at least Windows Vista and administrator
 *	 privileges!
 *
 * @param destination The path to the item which should symbolically link to the
 *		      source
 * @param source The path to the item for which a symbolic link should be
 *		 created
 */
- (void)createSymbolicLinkAtPath: (OFString *)destination
	     withDestinationPath: (OFString *)source;
#endif

#if defined(OF_HAVE_READLINK) || defined(OF_WINDOWS)
/*!
 * @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.
 *







|















|


















<

<







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
 *
 * 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
 * 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 path to the item which should symbolically link to the
 *		      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.
 *