summaryrefslogtreecommitdiffstats
path: root/path.c
diff options
context:
space:
mode:
Diffstat (limited to 'path.c')
-rw-r--r--path.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/path.c b/path.c
index 2a1d504ce3..7f4ce88f17 100644
--- a/path.c
+++ b/path.c
@@ -193,3 +193,19 @@ void set_codec_path(const char *path)
strcpy(codec_path, path);
needs_free = 1;
}
+
+const char *mp_basename(const char *path)
+{
+ char *s;
+
+#if HAVE_DOS_PATHS
+ s = strrchr(path, '\\');
+ if (s)
+ path = s + 1;
+ s = strrchr(path, ':');
+ if (s)
+ path = s + 1;
+#endif
+ s = strrchr(path, '/');
+ return s ? s + 1 : path;
+}