summaryrefslogtreecommitdiffstats
path: root/path.h
diff options
context:
space:
mode:
authorUoti Urpala <uau@glyph.nonexistent.invalid>2011-02-23 16:18:09 +0200
committerUoti Urpala <uau@glyph.nonexistent.invalid>2011-02-26 16:40:31 +0200
commit962eec0440ad65a71c09a9e206e110c62d9de3c8 (patch)
tree7e1f2b9406fa34859dfe67de8d4ea6b80bc09408 /path.h
parente8af22db818f839f5ac25a309e8838ea53e831b2 (diff)
downloadmpv-962eec0440ad65a71c09a9e206e110c62d9de3c8.tar.bz2
mpv-962eec0440ad65a71c09a9e206e110c62d9de3c8.tar.xz
bstr.[ch], path.[ch]: add string and path handling functions
Add some new string and path handling functions to be used in following commits. Use new path handling functions to simplify find_files().
Diffstat (limited to 'path.h')
-rw-r--r--path.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/path.h b/path.h
index 349f55e3cc..ffa052d680 100644
--- a/path.h
+++ b/path.h
@@ -21,11 +21,27 @@
#ifndef MPLAYER_PATH_H
#define MPLAYER_PATH_H
+#include "bstr.h"
+
extern char *codec_path;
char *get_path(const char *filename);
void set_path_env(void);
void set_codec_path(const char *path);
-const char *mp_basename(const char *path);
+
+// Return pointer to filename part of path
+
+char *mp_basename(const char *path);
+
+/* Return struct bstr referencing directory part of path, or if that
+ * would be empty, ".".
+ */
+struct bstr mp_dirname(const char *path);
+
+/* Join two path components and return a newly allocated string
+ * for the result. '/' is inserted between the components if needed.
+ * If p2 is an absolute path then the value of p1 is ignored.
+ */
+char *mp_path_join(void *talloc_ctx, struct bstr p1, struct bstr p2);
#endif /* MPLAYER_PATH_H */