diff options
author | wm4 <wm4@nowhere> | 2015-05-01 21:38:39 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-05-01 21:51:10 +0200 |
commit | 8192500716e3d151c1fec3b523df447683fe9724 (patch) | |
tree | 66eb6d91e8797460d7850e90f439667aaa63ef01 /osdep/path-win.c | |
parent | 7381db60e28dbedfb9215ca5a4c69aad78b713a4 (diff) | |
download | mpv-8192500716e3d151c1fec3b523df447683fe9724.tar.bz2 mpv-8192500716e3d151c1fec3b523df447683fe9724.tar.xz |
path: add resolving desktop path to platform-specific paths
win32 has a special function for this.
I'm not sure about OSX - it seems ~/Desktop can be hardcoded, and the
OSX GUI actually localizes the _displayed_ path in its UI.
For Unix, there is not much to be done, or is there.
Diffstat (limited to 'osdep/path-win.c')
-rw-r--r-- | osdep/path-win.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/osdep/path-win.c b/osdep/path-win.c index 26f7ffa62e..52cce6a61e 100644 --- a/osdep/path-win.c +++ b/osdep/path-win.c @@ -47,7 +47,7 @@ static char *mp_get_win_exe_subdir(void *talloc_ctx) return talloc_asprintf(talloc_ctx, "%s/mpv", mp_get_win_exe_dir(talloc_ctx)); } -static char *mp_get_win_app_dir(void *talloc_ctx) +static char *mp_get_win_shell_dir(void *talloc_ctx, int folder) { wchar_t w_appdir[MAX_PATH + 1] = {0}; @@ -55,7 +55,13 @@ static char *mp_get_win_app_dir(void *talloc_ctx) SHGFP_TYPE_CURRENT, w_appdir) != S_OK) return NULL; - return talloc_asprintf(talloc_ctx, "%s/mpv", mp_to_utf8(talloc_ctx, w_appdir)); + return mp_to_utf8(talloc_ctx, w_appdir); +} + +static char *mp_get_win_app_dir(void *talloc_ctx) +{ + char *path = mp_get_win_shell_dir(talloc_ctx, CSIDL_APPDATA); + return path ? mp_path_join(talloc_ctx, bstr0(path), bstr0("mpv")) : NULL; } const char *mp_get_platform_path_win(void *talloc_ctx, const char *type) @@ -67,5 +73,7 @@ const char *mp_get_platform_path_win(void *talloc_ctx, const char *type) // 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); + if (strcmp(type, "desktop") == 0) + return mp_get_win_shell_dir(talloc_ctx, CSIDL_DESKTOPDIRECTORY); return NULL; } |