summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-12-14 19:50:00 +0100
committerwm4 <wm4@nowhere>2013-12-14 19:54:49 +0100
commit683d7e88e46463497033eb4759ced45ee8b8cc49 (patch)
treeaa99cebe436f180c2d3c2e070ec4d3896386153a /video
parentdcf9f77c58691bde3e4e0ac60e5a5d7e1fc95b42 (diff)
downloadmpv-683d7e88e46463497033eb4759ced45ee8b8cc49.tar.bz2
mpv-683d7e88e46463497033eb4759ced45ee8b8cc49.tar.xz
Allow some options taking filenames to refer to mpv config dir
Add the mp_get_user_path() function, and make it expand special path prefixes. Use it for some things in mpv which take filenames (--input-config, --screenshot-template, opengl icc-profile suboption). This allows accessing files in the mpv config dir without hardcoding the config path by prefixing the path with ~~/. Details see manpage additions.
Diffstat (limited to 'video')
-rw-r--r--video/out/gl_lcms.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/video/out/gl_lcms.c b/video/out/gl_lcms.c
index 9999eca233..49a3a0346c 100644
--- a/video/out/gl_lcms.c
+++ b/video/out/gl_lcms.c
@@ -31,6 +31,7 @@
#include "mpvcore/bstr.h"
#include "mpvcore/mp_msg.h"
#include "mpvcore/m_option.h"
+#include "mpvcore/path.h"
#include "gl_video.h"
#include "gl_lcms.h"
@@ -90,11 +91,13 @@ static void lcms2_error_handler(cmsContext ctx, cmsUInt32Number code,
static struct bstr load_file(void *talloc_ctx, const char *filename)
{
struct bstr res = {0};
- stream_t *s = stream_open(filename, NULL);
+ char *fname = mp_get_user_path(NULL, filename);
+ stream_t *s = stream_open(fname, NULL);
if (s) {
res = stream_read_complete(s, talloc_ctx, 1000000000);
free_stream(s);
}
+ talloc_free(fname);
return res;
}