summaryrefslogtreecommitdiffstats
path: root/osdep/path-darwin.c
diff options
context:
space:
mode:
Diffstat (limited to 'osdep/path-darwin.c')
-rw-r--r--osdep/path-darwin.c13
1 files changed, 10 insertions, 3 deletions
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)