ObjFW  Check-in [f193f3fa8c]

Overview
Comment:Add +[OFFile symbolicLinkExistsAtPath:].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: f193f3fa8c8444b7177c49297372d0cb997561323466fbbc29c1980ca46cf53c
User & Date: js on 2013-12-09 22:08:41
Other Links: manifest | tags
Context
2013-12-09
22:19
Add +[OFFile copyItemAtPath:toPath:]. check-in: 169f06e1ec user: js tags: trunk
22:08
Add +[OFFile symbolicLinkExistsAtPath:]. check-in: f193f3fa8c user: js tags: trunk
22:07
Fix createSymbolicLinkAtPath:withDestinationPath:. check-in: ba2b4661de user: js tags: trunk
Changes

Modified src/OFFile.h from [26dd50cf9e] to [35a5c807f1].

89
90
91
92
93
94
95










96
97
98
99
100
101
102
/*!
 * @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 Creates a directory at the specified path.
 *
 * @param path The path of the directory
 */
+ (void)createDirectoryAtPath: (OFString*)path;







>
>
>
>
>
>
>
>
>
>







89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/*!
 * @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_HAVE_SYMLINK
/*!
 * @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
 */
+ (void)createDirectoryAtPath: (OFString*)path;

Modified src/OFFile.m from [0e60eafa58] to [9780f15c6e].

236
237
238
239
240
241
242



















243
244
245
246
247
248
249
#endif

	if (S_ISDIR(s.st_mode))
		return true;

	return false;
}




















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

#ifndef _WIN32







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







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
#endif

	if (S_ISDIR(s.st_mode))
		return true;

	return false;
}

#ifdef OF_HAVE_SYMLINK
+ (bool)symbolicLinkExistsAtPath: (OFString*)path
{
	struct stat s;

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

	if (lstat([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE],
	    &s) == -1)
		return false;

	if (S_ISLNK(s.st_mode))
		return true;

	return false;
}
#endif

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

#ifndef _WIN32