summaryrefslogtreecommitdiffstats
path: root/osdep/path-macosx.m
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-05-01 21:13:44 +0200
committerwm4 <wm4@nowhere>2015-05-01 21:51:10 +0200
commitd3a3cfe54c26055c0686ea1b9a245eb7f88af521 (patch)
tree98d1f00e030f5c2d1fa8a94515bbedb97489f335 /osdep/path-macosx.m
parent60958ddf9b1db1101f81c3db59b8e8c980af7cf2 (diff)
downloadmpv-d3a3cfe54c26055c0686ea1b9a245eb7f88af521.tar.bz2
mpv-d3a3cfe54c26055c0686ea1b9a245eb7f88af521.tar.xz
path: refactor
Somewhat less ifdeffery, higher flexibility. Now there are 3 separate config file resolvers for 3 platforms (unix, win, osx), and they can still interact with each other somewhat. For example, OSX for now uses most of Unix, but adds the OSX bundle path. This can be extended to resolve very specific platform paths, such as location of the desktop. Most of the Unix specific code moves to path-unix.c. The behavior should be the same - if not, it is likely a bug.
Diffstat (limited to 'osdep/path-macosx.m')
-rw-r--r--osdep/path-macosx.m16
1 files changed, 9 insertions, 7 deletions
diff --git a/osdep/path-macosx.m b/osdep/path-macosx.m
index ee34f9638b..618f2038c8 100644
--- a/osdep/path-macosx.m
+++ b/osdep/path-macosx.m
@@ -19,12 +19,14 @@
#include "options/path.h"
#include "osdep/path.h"
-int mp_add_macosx_bundle_dir(struct mpv_global *global, char **dirs, int i)
+const char *mp_get_platform_path_osx(void *talloc_ctx, const char *type)
{
- void *talloc_ctx = dirs;
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- NSString *path = [[NSBundle mainBundle] resourcePath];
- dirs[i++] = talloc_strdup(talloc_ctx, [path UTF8String]);
- [pool release];
- return i;
+ if (strcmp(type, "osxbundle") == 0) {
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ NSString *path = [[NSBundle mainBundle] resourcePath];
+ char *res = talloc_strdup(talloc_ctx, [path UTF8String]);
+ [pool release];
+ return res;
+ }
+ return NULL;
}