ObjFW  Check-in [ad8c9974bc]

Overview
Comment:Add +[currentDirectoryPath] to OFFile.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: ad8c9974bcd745efebb2b318cfbce8b905949a5caf6fdb936d0f089e899c3aec
User & Date: js on 2011-03-27 18:07:38
Other Links: manifest | tags
Context
2011-03-28
23:54
One more workaround for a bug in gcc 4.4.4 (possibly only Haiku). check-in: 12dd2db6ce user: js tags: trunk
2011-03-27
18:07
Add +[currentDirectoryPath] to OFFile. check-in: ad8c9974bc user: js tags: trunk
17:51
Pass the causing object for OFEnumerationMutationExceptions. check-in: f072e1a338 user: js tags: trunk
Changes

Modified src/OFFile.h from [dd9704b3e3] to [7b3dba70a0].

50
51
52
53
54
55
56





57
58
59
60
61
62
63
/**
 * \param fd A file descriptor, returned from for example open().
 *	     It is not closed when the OFFile object is deallocated!
 * \return A new autoreleased OFFile
 */
+ fileWithFileDescriptor: (int)fd;






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

/**







>
>
>
>
>







50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/**
 * \param fd A file descriptor, returned from for example open().
 *	     It is not closed when the OFFile object is deallocated!
 * \return A new autoreleased OFFile
 */
+ fileWithFileDescriptor: (int)fd;

/**
 * \return The path of the current working directory
 */
+ (OFString*)currentDirectoryPath;

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

/**

Modified src/OFFile.m from [e6cadbff05] to [7f0444f958].

170
171
172
173
174
175
176











177
178
179
180
181
182
183
				      mode: mode] autorelease];
}

+ fileWithFileDescriptor: (int)fd_
{
	return [[[self alloc] initWithFileDescriptor: fd_] autorelease];
}












+ (BOOL)fileExistsAtPath: (OFString*)path
{
	struct stat s;

	if (stat([path cString], &s) == -1)
		return NO;







>
>
>
>
>
>
>
>
>
>
>







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
				      mode: mode] autorelease];
}

+ fileWithFileDescriptor: (int)fd_
{
	return [[[self alloc] initWithFileDescriptor: fd_] autorelease];
}

+ (OFString*)currentDirectoryPath
{
	char *buf = getcwd(NULL, 0);

	@try {
		return [OFString stringWithCString: buf];
	} @finally {
		free(buf);
	}
}

+ (BOOL)fileExistsAtPath: (OFString*)path
{
	struct stat s;

	if (stat([path cString], &s) == -1)
		return NO;