Index: src/OFFile.h ================================================================== --- src/OFFile.h +++ src/OFFile.h @@ -52,10 +52,15 @@ * 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; Index: src/OFFile.m ================================================================== --- src/OFFile.m +++ src/OFFile.m @@ -172,10 +172,21 @@ + 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;