summaryrefslogtreecommitdiffstats
path: root/core/path.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-07-08 20:34:26 +0200
committerwm4 <wm4@nowhere>2013-07-08 20:37:11 +0200
commitc460258f5a85d8d65261b524f23a3608185e58e4 (patch)
tree60974ce21dfb5fe338bf091548e1d0155bba19e9 /core/path.c
parent0bb41524f0a9ed89559b50bd7407de9d8b8aee40 (diff)
downloadmpv-c460258f5a85d8d65261b524f23a3608185e58e4.tar.bz2
mpv-c460258f5a85d8d65261b524f23a3608185e58e4.tar.xz
command: add screenshot_to_file command
Diffstat (limited to 'core/path.c')
-rw-r--r--core/path.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/core/path.c b/core/path.c
index 1cff719041..50350be18c 100644
--- a/core/path.c
+++ b/core/path.c
@@ -164,6 +164,17 @@ struct bstr mp_dirname(const char *path)
return ret;
}
+char *mp_splitext(const char *path, bstr *root)
+{
+ assert(path);
+ const char *split = strrchr(path, '.');
+ if (!split)
+ split = path + strlen(path);
+ if (root)
+ *root = (bstr){.start = (char *)path, .len = path - split};
+ return (char *)split;
+}
+
char *mp_path_join(void *talloc_ctx, struct bstr p1, struct bstr p2)
{
if (p1.len == 0)