summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorm154k1 <139042094+m154k1@users.noreply.github.com>2023-07-15 20:19:52 +0300
committerDudemanguy <random342@airmail.cc>2023-07-15 23:56:57 +0000
commitb077cf72df6b5c8270c72184a976a2b5aa6d40f1 (patch)
treed9e27b8806e90f9f5768ec84bd71944a6c7a66fa
parent031e172cefeb9e6596d8a816a23dfeafb888cccb (diff)
downloadmpv-b077cf72df6b5c8270c72184a976a2b5aa6d40f1.tar.bz2
mpv-b077cf72df6b5c8270c72184a976a2b5aa6d40f1.tar.xz
player: set default cache dir on macOS
Use ~/Library/Caches/io.mpv for caches instead of ~~home.
-rw-r--r--DOCS/man/mpv.rst8
-rw-r--r--osdep/path-darwin.c13
2 files changed, 18 insertions, 3 deletions
diff --git a/DOCS/man/mpv.rst b/DOCS/man/mpv.rst
index c7c11fd2cb..8619d8b00e 100644
--- a/DOCS/man/mpv.rst
+++ b/DOCS/man/mpv.rst
@@ -1678,3 +1678,11 @@ future.
Note that mpv likes to mix ``/`` and ``\`` path separators for simplicity.
kernel32.dll accepts this, but cmd.exe does not.
+
+FILES ON MACOS
+==============
+
+On macOS the watch later directory is located at ``~/.config/mpv/watch_later/``
+and the cache directory is set to ``~/Library/Caches/io.mpv/``. These directories
+can't be overwritten by enviroment variables.
+Everything else is the same as `FILES`_.
diff --git a/osdep/path-darwin.c b/osdep/path-darwin.c
index da8285182d..4382def498 100644
--- a/osdep/path-darwin.c
+++ b/osdep/path-darwin.c
@@ -27,14 +27,15 @@ 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 void path_init(void)
{
char *home = getenv("HOME");
- char *xdg_dir = getenv("XDG_CONFIG_HOME");
+ char *xdg_config = getenv("XDG_CONFIG_HOME");
- if (xdg_dir && xdg_dir[0]) {
- snprintf(mpv_home, sizeof(mpv_home), "%s/mpv", xdg_dir);
+ if (xdg_config && xdg_config[0]) {
+ snprintf(mpv_home, sizeof(mpv_home), "%s/mpv", xdg_config);
} else if (home && home[0]) {
snprintf(mpv_home, sizeof(mpv_home), "%s/.config/mpv", home);
}
@@ -43,10 +44,14 @@ static void path_init(void)
if (home && home[0])
snprintf(old_home, sizeof(old_home), "%s/.mpv", home);
+ if (home && home[0])
+ snprintf(mpv_cache, sizeof(mpv_cache), "%s/Library/Caches/io.mpv", home);
+
// If the old ~/.mpv exists, and the XDG config dir doesn't, use the old
// 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);
old_home[0] = '\0';
}
}
@@ -58,6 +63,8 @@ const char *mp_get_platform_path_darwin(void *talloc_ctx, const char *type)
return mpv_home;
if (strcmp(type, "old_home") == 0)
return old_home;
+ if (strcmp(type, "cache") == 0)
+ return mpv_cache;
if (strcmp(type, "global") == 0)
return MPV_CONFDIR;
if (strcmp(type, "desktop") == 0)