1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-11 09:25:56 +00:00

path: expose platform-specific path resolvers

This commit is contained in:
wm4 2015-05-01 21:27:33 +02:00
parent 6814830b9a
commit 7381db60e2
2 changed files with 15 additions and 1 deletions

View File

@ -330,7 +330,16 @@ additionally wrapped in the fixed-length syntax, e.g. ``%n%string_of_length_n``
Some mpv options interpret paths starting with ``~``. Currently, the prefix Some mpv options interpret paths starting with ``~``. Currently, the prefix
``~~/`` expands to the mpv configuration directory (usually ``~/.config/mpv/``). ``~~/`` expands to the mpv configuration directory (usually ``~/.config/mpv/``).
``~/`` expands to the user's home directory. (The trailing ``/`` is always ``~/`` expands to the user's home directory. (The trailing ``/`` is always
required.) required.) There are the following paths as well:
=============== ================================================================
Name Meaning
=============== ================================================================
``~home/`` same as ``~~/``
``~global/`` the global config path, if available
``~osxbundle/`` the OSX bundle resource path (OSX only)
=============== ================================================================
Per-File Options Per-File Options
---------------- ----------------

View File

@ -182,6 +182,11 @@ char *mp_get_user_path(void *talloc_ctx, struct mpv_global *global,
res = mp_find_config_file(talloc_ctx, global, rest0); res = mp_find_config_file(talloc_ctx, global, rest0);
} else if (bstr_equals0(prefix, "")) { } else if (bstr_equals0(prefix, "")) {
res = mp_path_join(talloc_ctx, bstr0(getenv("HOME")), rest); res = mp_path_join(talloc_ctx, bstr0(getenv("HOME")), rest);
} else {
char type[80];
snprintf(type, sizeof(type), "%.*s", BSTR_P(prefix));
res = talloc_strdup(talloc_ctx,
mp_get_platform_path(talloc_ctx, type));
} }
} }
} }