blob: cb182870865c978d00ab6faeb7a2f6b5b41da2f4 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
/*
osxsupport.m - Cocoa glue to emulated deprecated old Carbon path finder functions
*/
#import <Cocoa/Cocoa.h>
#import <AvailabilityMacros.h>
#include "osxsupport.h"
// convert an NSString to a C string
static char *StringToChar(NSString *str)
{
const char *charstr = [str UTF8String];
char *resstr = (char *)malloc(strlen(charstr)+1);
strcpy(resstr, charstr);
return resstr;
}
char *FindPrefsDir(void)
{
char *resstr = NULL;
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSPreferencePanesDirectory, NSUserDomainMask, YES);
if ([paths count] > 0)
{
resstr = StringToChar([paths objectAtIndex:0]) ;
}
return resstr;
}
|