summaryrefslogtreecommitdiffstats
path: root/osdep/path-darwin.c
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2023-09-04 16:58:59 -0500
committerDudemanguy <random342@airmail.cc>2023-09-07 13:59:49 +0000
commit499dce5ba127e8dde11e25d720881cb0646d55f9 (patch)
tree9bb233a4eb908770a17b89722fcd82499bb5ae28 /osdep/path-darwin.c
parentbced1eec4e811c260891ca538a84145523fa2dfd (diff)
downloadmpv-499dce5ba127e8dde11e25d720881cb0646d55f9.tar.bz2
mpv-499dce5ba127e8dde11e25d720881cb0646d55f9.tar.xz
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.
Diffstat (limited to 'osdep/path-darwin.c')
-rw-r--r--osdep/path-darwin.c8
1 files changed, 6 insertions, 2 deletions
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';
}
}