From d3a3cfe54c26055c0686ea1b9a245eb7f88af521 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 1 May 2015 21:13:44 +0200 Subject: 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. --- osdep/path-win.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'osdep/path-win.c') diff --git a/osdep/path-win.c b/osdep/path-win.c index 66d8de96e4..26f7ffa62e 100644 --- a/osdep/path-win.c +++ b/osdep/path-win.c @@ -58,14 +58,14 @@ static char *mp_get_win_app_dir(void *talloc_ctx) return talloc_asprintf(talloc_ctx, "%s/mpv", mp_to_utf8(talloc_ctx, w_appdir)); } -int mp_add_win_config_dirs(struct mpv_global *global, char **dirs, int i) +const char *mp_get_platform_path_win(void *talloc_ctx, const char *type) { - void *talloc_ctx = dirs; - if ((dirs[i] = mp_get_win_app_dir(talloc_ctx))) - i++; - if ((dirs[i] = mp_get_win_exe_dir(talloc_ctx))) - i++; - if ((dirs[i] = mp_get_win_exe_subdir(talloc_ctx))) - i++; - return i; + if (strcmp(type, "home") == 0) + return mp_get_win_app_dir(talloc_ctx); + if (strcmp(type, "old_home") == 0) + return mp_get_win_exe_dir(talloc_ctx); + // Not really true, but serves as a way to return a lowest-priority dir. + if (strcmp(type, "global") == 0) + return mp_get_win_exe_subdir(talloc_ctx); + return NULL; } -- cgit v1.2.3