I know there's a method to do just that in Leopard, however I want my app to work on Tiger too, therefore I'm trying to put together a simple "createDirectoryRecursivelyAtPath" method, however for some reason it doesn't seem to work....

Here's a simplified version of my method:

- (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)
        {
                // Fine, create the dir...
                [fileManager createDirectoryAtPath:path attributes:nil];
        }
        else
        {
                // call ourself with the directory above...
                [self createDirectoryRecursivelyAtPath:directoryAbove];
        }
}

Am I missing something? If I'm trying to create for example: /a/b/c (and none of them exists) only /a is created...

Jean-Nicolas Jolivet
_______________________________________________

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]

Reply via email to