diff options
author | Dudemanguy <random342@airmail.cc> | 2023-07-12 09:05:46 -0500 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2023-07-15 15:10:41 +0000 |
commit | d482bf6ef0cacf58efe70daf4d2d721eff1a7b4f (patch) | |
tree | 85b16e1cb6d17c26078f6f72e286e77fff12d5e9 /osdep | |
parent | 93f95f61e92499c5fe2975add2e86d89b0a563b5 (diff) | |
download | mpv-d482bf6ef0cacf58efe70daf4d2d721eff1a7b4f.tar.bz2 mpv-d482bf6ef0cacf58efe70daf4d2d721eff1a7b4f.tar.xz |
path-win: implement cache directories
4502522a7aee093c923e79a65e4684ea2634af30 implemented cache directories
but only on linux which meant other OSes continued to save this stuff in
their config directory. Since we turned on cache by default, people are
getting cache files in there which is understandably causing some
confusion. Let's go ahead and implement a separate cache directory for
windows since there seems to be some established conventions for this
already. For people using the portable_path, the cache is saved in a
subdirectory within the portable_path since the idea is for that to be
completely self contained.
Diffstat (limited to 'osdep')
-rw-r--r-- | osdep/path-win.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/osdep/path-win.c b/osdep/path-win.c index 78e83c2222..18f03561b7 100644 --- a/osdep/path-win.c +++ b/osdep/path-win.c @@ -71,6 +71,11 @@ static char *mp_get_win_app_dir(void *talloc_ctx) return path ? mp_path_join(talloc_ctx, path, "mpv") : NULL; } +static char *mp_get_win_local_app_dir(void *talloc_ctx) +{ + char *path = mp_get_win_shell_dir(talloc_ctx, &FOLDERID_LocalAppData); + return path ? mp_path_join(talloc_ctx, path, "mpv") : NULL; +} static void path_init(void) { @@ -87,9 +92,13 @@ const char *mp_get_platform_path_win(void *talloc_ctx, const char *type) if (portable_path) { if (strcmp(type, "home") == 0) return portable_path; + if (strcmp(type, "cache") == 0) + return mp_path_join(talloc_ctx, portable_path, "cache"); } else { if (strcmp(type, "home") == 0) return mp_get_win_app_dir(talloc_ctx); + if (strcmp(type, "cache") == 0) + return mp_get_win_local_app_dir(talloc_ctx); if (strcmp(type, "exe_dir") == 0) return mp_get_win_exe_dir(talloc_ctx); // Not really true, but serves as a way to return a lowest-priority dir. |