|author||wm4 <wm4@nowhere>||2013-12-14 19:50:00 +0100|
|committer||wm4 <wm4@nowhere>||2013-12-14 19:54:49 +0100|
Allow some options taking filenames to refer to mpv config dir
Add the mp_get_user_path() function, and make it expand special path prefixes. Use it for some things in mpv which take filenames (--input-config, --screenshot-template, opengl icc-profile suboption). This allows accessing files in the mpv config dir without hardcoding the config path by prefixing the path with ~~/. Details see manpage additions.
Diffstat (limited to 'DOCS')
1 files changed, 22 insertions, 0 deletions
diff --git a/DOCS/man/en/mpv.rst b/DOCS/man/en/mpv.rst
index 44a0c36f80..003a36ed53 100644
@@ -285,6 +285,28 @@ It has the following format::
``mpv --ao=pcm:file=%`expr length "$NAME"`%"$NAME" test.avi``
+Some care must be taken when passing arbitrary paths and filenames to mpv. For
+example, paths starting with ``-`` will be interpreted as options. Likewise,
+if a path contains the sequence ``://``, the string before that might be
+interpreted as protocol prefix, even though ``://`` can be part of a legal
+UNIX path. To avoid problems with arbitrary paths, you should be sure that
+absolute paths passed to mpv start with ``/``, and relative paths with ``./``.
+The name ``-`` itself is interpreted as stdin, and will cause mpv to disable
+console controls. (Which makes it suitable for playing data piped to stdin.)
+For paths passed to suboptions, the situation is further complicated by the
+need to escape special characters. To work this around, the path can be
+additionally wrapped in the ``%n%string_of_length_n`` syntax (see above).
+Some mpv options interpret paths starting with ``~``. Currently, the prefix
+``~~/`` expands to the mpv configuration directory (usually ``~/.mpv/``).
+``~/`` expands to the user's home directory. (The trailing ``/`` is always