diff options
author | Nicolas F <ovdev@fratti.ch> | 2017-10-31 00:28:27 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2017-11-02 17:07:35 +0100 |
commit | 49e925f8307a3988a1f01ee2917f23d252dcbdc3 (patch) | |
tree | bd545c0eeca31c9a57cec307ce7ac75f333731da /player | |
parent | f099f504af5a7471edd7f1b1e508ec0c8b23f3ab (diff) | |
download | mpv-49e925f8307a3988a1f01ee2917f23d252dcbdc3.tar.bz2 mpv-49e925f8307a3988a1f01ee2917f23d252dcbdc3.tar.xz |
screenshot: create directories from template
screenshot-template could be set to e.g. "%F/%04n", so we want to
make sure that the path generated from the template actually exists.
Diffstat (limited to 'player')
-rw-r--r-- | player/screenshot.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/player/screenshot.c b/player/screenshot.c index dae39fdbae..5234b39d8e 100644 --- a/player/screenshot.c +++ b/player/screenshot.c @@ -364,6 +364,11 @@ static char *gen_fname(screenshot_ctx *ctx, const char *file_ext) talloc_free(t); } + char *full_dir = bstrto0(fname, mp_dirname(fname)); + if (!mp_path_exists(full_dir)) { + mp_mkdirp(full_dir); + } + if (!mp_path_exists(fname)) return fname; |