summaryrefslogtreecommitdiffstats
path: root/libhb/platform/macosx/config.m
blob: c30f34c4a5088122af27f0e8c837fce90a36ea6a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#import <Foundation/Foundation.h>

int osx_get_user_config_directory(char path[512])
{
    @autoreleasepool
    {
        NSArray *paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory,
                                                             NSUserDomainMask, YES);
        NSString  *dir = paths.firstObject;
        if (dir.UTF8String == nil)
        {
            return -1;
        }

        strncpy(path, dir.UTF8String, 511);
        path[511] = 0;
        return 0;
    }
}