From ff1b5432e777c83af9ac55cc72ecd7a7344b9476 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 2 May 2015 16:29:30 +0200 Subject: [PATCH] vo_opengl: gl_lcms: use mp_path_join() Maybe this fixes the win32 problems a user had, or maybe not. Also, check if cache_dir is set at all. An empty string should be equivalent to "unset". --- video/out/gl_lcms.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/video/out/gl_lcms.c b/video/out/gl_lcms.c index 6f98fc9456..337664d8b9 100644 --- a/video/out/gl_lcms.c +++ b/video/out/gl_lcms.c @@ -206,7 +206,7 @@ bool gl_lcms_get_lut3d(struct gl_lcms *p, struct lut3d **result_lut3d) cmsContext cms = NULL; char *cache_file = NULL; - if (p->opts.cache_dir) { + if (p->opts.cache_dir && p->opts.cache_dir[0]) { // Gamma is included in the header to help uniquely identify it, // because we may change the parameter in the future or make it // customizable, same for the primaries. @@ -224,10 +224,10 @@ bool gl_lcms_get_lut3d(struct gl_lcms *p, struct lut3d **result_lut3d) av_sha_final(sha, hash); av_free(sha); - cache_file = talloc_strdup(tmp, p->opts.cache_dir); - cache_file = talloc_asprintf_append(cache_file, "/"); + cache_file = talloc_strdup(tmp, ""); for (int i = 0; i < sizeof(hash); i++) cache_file = talloc_asprintf_append(cache_file, "%02X", hash[i]); + cache_file = mp_path_join(tmp, bstr0(p->opts.cache_dir), bstr0(cache_file)); } // check cache