diff options
author | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2011-02-23 16:18:09 +0200 |
---|---|---|
committer | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2011-02-26 16:40:31 +0200 |
commit | 962eec0440ad65a71c09a9e206e110c62d9de3c8 (patch) | |
tree | 7e1f2b9406fa34859dfe67de8d4ea6b80bc09408 /path.h | |
parent | e8af22db818f839f5ac25a309e8838ea53e831b2 (diff) | |
download | mpv-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.h | 18 |
1 files changed, 17 insertions, 1 deletions
@@ -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 */ |