summaryrefslogtreecommitdiffstats
path: root/screenshot.c
diff options
context:
space:
mode:
Diffstat (limited to 'screenshot.c')
-rw-r--r--screenshot.c19
1 files changed, 4 insertions, 15 deletions
diff --git a/screenshot.c b/screenshot.c
index 7fb5fd9507..1f2b0694fc 100644
--- a/screenshot.c
+++ b/screenshot.c
@@ -66,19 +66,6 @@ static char *stripext(void *talloc_ctx, const char *s)
return talloc_asprintf(talloc_ctx, "%.*s", end - s, s);
}
-static char *do_format_property(struct MPContext *mpctx, struct bstr s) {
- struct bstr prop_name = s;
- int fallbackpos = bstrchr(s, ':');
- if (fallbackpos >= 0)
- prop_name = bstr_splice(prop_name, 0, fallbackpos);
- char *pn = bstrdup0(NULL, prop_name);
- char *res = mp_property_print(pn, mpctx);
- talloc_free(pn);
- if (!res && fallbackpos >= 0)
- res = bstrdup0(NULL, bstr_cut(s, fallbackpos + 1));
- return res;
-}
-
#ifdef _WIN32
#define ILLEGAL_FILENAME_CHARS "?\"/\\<>*|:"
#else
@@ -186,11 +173,13 @@ static char *create_fname(struct MPContext *mpctx, char *template,
if (!end)
goto error_exit;
struct bstr prop = bstr_splice(bstr0(template), 0, end - template);
- template = end + 1;
- char *s = do_format_property(mpctx, prop);
+ char *tmp = talloc_asprintf(NULL, "${%.*s}", BSTR_P(prop));
+ char *s = mp_property_expand_string(mpctx, tmp);
+ talloc_free(tmp);
if (s)
append_filename(&res, s);
talloc_free(s);
+ template = end + 1;
break;
}
case '%':