diff options
author | wm4 <wm4@nowhere> | 2013-07-08 21:55:44 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-07-08 21:55:44 +0200 |
commit | 31f685040bd2152d541ed16cf441c6b5e7e430fd (patch) | |
tree | b8351b2847231bbc15d883a622ac972945cce6b4 /core/path.c | |
parent | 73c76de91edbf8a55eb725196ff54583e3428510 (diff) | |
parent | 7a71a2cc483d17bed94408d5aee6fba6893558cb (diff) | |
download | mpv-31f685040bd2152d541ed16cf441c6b5e7e430fd.tar.bz2 mpv-31f685040bd2152d541ed16cf441c6b5e7e430fd.tar.xz |
Merge branch 'master' into remove_old_demuxers
Conflicts:
DOCS/man/en/changes.rst
DOCS/man/en/options.rst
Diffstat (limited to 'core/path.c')
-rw-r--r-- | core/path.c | 11 |
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) |