ObjFW  Check-in [2ef0a01201]

Overview
Comment:Add +[createDirectoryAtPath:] to OFFile.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 2ef0a01201515d564420771f0d96f22fef80e88980f6c31337fb6f3418cb9eca
User & Date: js on 2010-04-15 08:43:12
Other Links: manifest | tags
Context
2010-04-15
17:19
Win32 version of OFFile's +[filesInDirectoryAtPath:]. check-in: c4f5d6f491 user: js tags: trunk
08:43
Add +[createDirectoryAtPath:] to OFFile. check-in: 2ef0a01201 user: js tags: trunk
08:43
Add OFCreateDirectoryFailedException. check-in: ffc622db15 user: js tags: trunk
Changes

Modified src/OFFile.h from [658c0aafbb] to [791357b029].

49
50
51
52
53
54
55







56
57
58
59
60
61
62

/**
 * \param path The path to check
 * \return A boolean whether there is a directory at the specified path
 */
+ (BOOL)directoryExistsAtPath: (OFString*)path;








/**
 * \param path The path of the directory
 * \return An array of OFStrings with the files at the specified path
 */
+ (OFArray*)filesInDirectoryAtPath: (OFString*)path;

/**







>
>
>
>
>
>
>







49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69

/**
 * \param path The path to check
 * \return A boolean whether there is a directory at the specified path
 */
+ (BOOL)directoryExistsAtPath: (OFString*)path;

/**
 * Creates a directory at the specified path.
 *
 * \param path The path of the directory
 */
+ (void)createDirectoryAtPath: (OFString*)path;

/**
 * \param path The path of the directory
 * \return An array of OFStrings with the files at the specified path
 */
+ (OFArray*)filesInDirectoryAtPath: (OFString*)path;

/**

Modified src/OFFile.m from [9b3c83ec11] to [b3c752e8de].

38
39
40
41
42
43
44

45
46
47
48
49
50
51
# define S_IRGRP 0
#endif
#ifndef S_IROTH
# define S_IROTH 0
#endif

#define DEFAULT_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH


OFFile *of_stdin = nil;
OFFile *of_stdout = nil;
OFFile *of_stderr = nil;

static int parse_mode(const char *mode)
{







>







38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# define S_IRGRP 0
#endif
#ifndef S_IROTH
# define S_IROTH 0
#endif

#define DEFAULT_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH
#define DIR_MODE DEFAULT_MODE | S_IXUSR | S_IXGRP | S_IXOTH

OFFile *of_stdin = nil;
OFFile *of_stdout = nil;
OFFile *of_stderr = nil;

static int parse_mode(const char *mode)
{
126
127
128
129
130
131
132







133
134
135
136
137
138
139
		return NO;

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

	return NO;
}








+ (OFArray*)filesInDirectoryAtPath: (OFString*)path
{
	OFAutoreleasePool *pool;
	OFMutableArray *files;
	DIR *dir;
	struct dirent *dirent;







>
>
>
>
>
>
>







127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
		return NO;

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

	return NO;
}

+ (void)createDirectoryAtPath: (OFString*)path
{
	if (mkdir([path cString], DIR_MODE))
		@throw [OFCreateDirectoryFailedException newWithClass: self
								 path: path];
}

+ (OFArray*)filesInDirectoryAtPath: (OFString*)path
{
	OFAutoreleasePool *pool;
	OFMutableArray *files;
	DIR *dir;
	struct dirent *dirent;