command: add normalize-path command
This can be used e.g. by a bookmarking script to show normalized paths.
This commit is contained in:
1 parent
b6615cd474
commit
6ec3e1549d
3 files changed
+30
No files matched your search
@@ -5644,6 +5644,19 @@ static void cmd_expand_path(void *p)
|
||||
};
|
||||
}
|
||||
|
||||
static void cmd_normalize_path(void *p)
|
||||
{
|
||||
struct mp_cmd_ctx *cmd = p;
|
||||
void *ctx = talloc_new(NULL);
|
||||
|
||||
cmd->result = (mpv_node){
|
||||
.format = MPV_FORMAT_STRING,
|
||||
.u.string = talloc_strdup(NULL, mp_normalize_path(ctx, cmd->args[0].v.s)),
|
||||
};
|
||||
|
||||
talloc_free(ctx);
|
||||
}
|
||||
|
||||
static void cmd_escape_ass(void *p)
|
||||
{
|
||||
struct mp_cmd_ctx *cmd = p;
|
||||
@@ -6764,6 +6777,7 @@ const struct mp_cmd_def mp_cmds[] = {
|
||||
.is_noisy = true },
|
||||
{ "expand-path", cmd_expand_path, { {"text", OPT_STRING(v.s)} },
|
||||
.is_noisy = true },
|
||||
{ "normalize-path", cmd_normalize_path, { {"filename", OPT_STRING(v.s)} }},
|
||||
{ "escape-ass", cmd_escape_ass, { {"text", OPT_STRING(v.s)} },
|
||||
.is_noisy = true },
|
||||
{ "show-progress", cmd_show_progress, .allow_auto_repeat = true,
|
||||
|
||||
Reference in new issue
Block a user