summaryrefslogtreecommitdiffstats
path: root/libhb/platform/macosx/config.m
diff options
context:
space:
mode:
Diffstat (limited to 'libhb/platform/macosx/config.m')
-rw-r--r--libhb/platform/macosx/config.m21
1 files changed, 13 insertions, 8 deletions
diff --git a/libhb/platform/macosx/config.m b/libhb/platform/macosx/config.m
index 9fa86aaaf..c30f34c4a 100644
--- a/libhb/platform/macosx/config.m
+++ b/libhb/platform/macosx/config.m
@@ -1,14 +1,19 @@
#import <Foundation/Foundation.h>
-/* #import <Cocoa/Cocoa.h> */
-void osx_get_user_config_directory(char path[512])
+int osx_get_user_config_directory(char path[512])
{
- @autoreleasepool {
- NSArray *paths = NSSearchPathForDirectoriesInDomains(
- NSApplicationSupportDirectory, NSUserDomainMask, YES);
- NSString *dir = paths[0];
- strncpy(path, dir.UTF8String, 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;
}
}
-