From 499dce5ba127e8dde11e25d720881cb0646d55f9 Mon Sep 17 00:00:00 2001 From: Dudemanguy Date: Mon, 4 Sep 2023 16:58:59 -0500 Subject: path-{darwin,unix}: save cache to subdir when using non-XDG path mpv saves cache by default nowadays, but vo_gpu is pretty spammy and saves a bunch of files per shader. If someone is using the non-XDG config directory, this all gets dumped directly into ~/.mpv which isn't so nice. Save it to a sub directory called "cache" instead (or alternatively submit to your XDG overlords). For unfortunate reasons, macOS uses XDG_CONFIG_HOME and has the same legacy fallback mechanism, so this applies to it too. --- osdep/path-darwin.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'osdep/path-darwin.c') diff --git a/osdep/path-darwin.c b/osdep/path-darwin.c index 4382def498..0b55ea4c56 100644 --- a/osdep/path-darwin.c +++ b/osdep/path-darwin.c @@ -28,6 +28,7 @@ static pthread_once_t path_init_once = PTHREAD_ONCE_INIT; static char mpv_home[512]; static char old_home[512]; static char mpv_cache[512]; +static char old_cache[512]; static void path_init(void) { @@ -41,8 +42,10 @@ static void path_init(void) } // Maintain compatibility with old ~/.mpv - if (home && home[0]) + if (home && home[0]) { snprintf(old_home, sizeof(old_home), "%s/.mpv", home); + snprintf(old_cache, sizeof(old_cache), "%s/.mpv/cache", home); + } if (home && home[0]) snprintf(mpv_cache, sizeof(mpv_cache), "%s/Library/Caches/io.mpv", home); @@ -51,8 +54,9 @@ static void path_init(void) // config dir only. if (mp_path_exists(old_home) && !mp_path_exists(mpv_home)) { snprintf(mpv_home, sizeof(mpv_home), "%s", old_home); - snprintf(mpv_cache, sizeof(mpv_cache), "%s", old_home); + snprintf(mpv_cache, sizeof(mpv_cache), "%s", old_cache); old_home[0] = '\0'; + old_cache[0] = '\0'; } } -- cgit v1.2.3