#import <Cocoa/Cocoa.h>

char* get_mac_data_dir()
{
    NSAutoreleasePool	*pool = [[NSAutoreleasePool alloc] init];
	NSString * path = [[[[NSBundle mainBundle] bundlePath] stringByDeletingLastPathComponent] stringByAppendingString:@"/data"];
	
	if ([path canBeConvertedToEncoding:[NSString defaultCStringEncoding]])
	{
		char* cpath = (char*) malloc([path cStringLength] + 2);
		[path getCString:cpath];
		cpath[[path cStringLength]] = '\0';
		
		[pool release];
		return cpath;
	}
	else
	{
		NSRunAlertPanel(@"vdrift error", @"vdrift can't find it's data. please move vdrift to a sane location on your harddisk, without weird characters in it's path!", @"I Will", nil, nil);
		[pool release];
		exit(1);
	}
}