Documents Directory

Simple C function to retrive the path of the documents directory in iOS



NSString *documentsDirectory(void)
{
static NSString *docPath = nil;
if(docPath == nil)
{
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
docPath = [[paths objectAtIndex:0] retain];
}
return docPath;
}