On Nov 13, 2008, at 10:11, Etienne Guérard wrote:
You might want to do it this way:- (void)createDirectoryRecursivelyAtPath:(NSString *)path { //check if the dir just above exists... NSFileManager *fileManager = [NSFileManager defaultManager]; BOOL isDir; NSString *directoryAbove = [path stringByDeletingLastPathComponent]; if (![fileManager fileExistsAtPath:directoryAbove isDirectory:&isDir] && isDir) { // call ourself with the directory above... [self createDirectoryRecursivelyAtPath:directoryAbove]; } // Now we enforced that the dir exist // Fine, create the dir... [fileManager createDirectoryAtPath:path attributes:nil]; }
Or even this way: [[NSFileManager defaultManger] createDirectoryAtPath: path withIntermediateDirectories: YES attributes: nil error: &error]?
_______________________________________________ Cocoa-dev mailing list ([email protected]) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
