summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-05-02 16:38:38 +0200
committerwm4 <wm4@nowhere>2015-05-02 16:38:38 +0200
commit15d8cf7fa2b17d3e7d4376242b35c9edcec896b7 (patch)
treeff1f3633aef0af6f69c8396d5d9c818e2e986b4d
parentf509a2badb80f9d80ad72ae219b47612cc054218 (diff)
downloadmpv-15d8cf7fa2b17d3e7d4376242b35c9edcec896b7.tar.bz2
mpv-15d8cf7fa2b17d3e7d4376242b35c9edcec896b7.tar.xz
screenshots: create screenshot dir
Minor user convenience.
-rw-r--r--DOCS/man/options.rst5
-rw-r--r--player/screenshot.c2
2 files changed, 5 insertions, 2 deletions
diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst
index facff53073..52c42b58c8 100644
--- a/DOCS/man/options.rst
+++ b/DOCS/man/options.rst
@@ -2661,8 +2661,9 @@ Screenshot
generated by ``--screenshot-template``. If the template filename is already
absolute, the directory is ignored.
- If the directory does not exist or is not a directory, an error is
- generated.
+ If the directory does not exist, it is created on the first screenshot. If
+ it is not a directory, an error is generated when trying to write a
+ screenshot.
This option is not set by default, and thus will write screenshots to the
directory from which mpv was started. In pseudo-gui mode
diff --git a/player/screenshot.c b/player/screenshot.c
index 1db1d95996..63db569afb 100644
--- a/player/screenshot.c
+++ b/player/screenshot.c
@@ -286,6 +286,8 @@ static char *gen_fname(screenshot_ctx *ctx, const char *file_ext)
dir = mp_get_user_path(t, ctx->mpctx->global, dir);
fname = mp_path_join(NULL, bstr0(dir), bstr0(fname));
talloc_free(t);
+
+ mp_mkdirp(dir);
}
if (!mp_path_exists(fname))