1 #import <Foundation/NSPathUtilities.h>
3 unsigned get_home_dir(char *buf, unsigned size)
5 NSString *path = NSHomeDirectory();
6 if(![path getCString:buf maxLength:size encoding:NSUTF8StringEncoding])
9 return [path lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
12 unsigned get_application_support_dir(char *buf, unsigned size)
14 NSArray *dirs = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
18 NSString *path = [dirs objectAtIndex:0];
19 if(![path getCString:buf maxLength:size encoding:NSUTF8StringEncoding])
22 return [path lengthOfBytesUsingEncoding:NSUTF8StringEncoding];