diff options
Diffstat (limited to 'player/configfiles.c')
-rw-r--r-- | player/configfiles.c | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/player/configfiles.c b/player/configfiles.c index 2794ddaebf..a295d7d9f2 100644 --- a/player/configfiles.c +++ b/player/configfiles.c @@ -71,21 +71,22 @@ bool mp_parse_cfgfiles(struct MPContext *mpctx) // The #if is a stupid hack to avoid errors if libavfilter is not available. #if HAVE_LIBAVFILTER && HAVE_ENCODING conffile = mp_find_config_file(tmp, mpctx->global, "encoding-profiles.conf"); - if (conffile && mp_path_exists(conffile)) + if (conffile) m_config_parse_config_file(mpctx->mconfig, conffile, SECT_ENCODE, 0); #endif - conffile = mp_find_global_config_file(tmp, mpctx->global, "mpv.conf"); - if (conffile && m_config_parse_config_file(conf, conffile, section, 0) < 0) { - r = false; - goto done; + // Maintain compatibility with /config + for (char** cf = mp_find_all_config_files(tmp, mpctx->global, "config"); *cf; cf++) { + if (m_config_parse_config_file(conf, *cf, section, 0) < 0) { + r = false; + goto done; + } } - mp_mk_config_dir(mpctx->global, NULL); - if (!(conffile = mp_find_user_config_file(tmp, mpctx->global, "config"))) - MP_ERR(mpctx, "mp_find_user_config_file(\"config\") problem\n"); - else if (m_config_parse_config_file(conf, conffile, section, 0) < 0) { - r = false; - goto done; + for (char** cf = mp_find_all_config_files(tmp, mpctx->global, "mpv.conf"); *cf; cf++) { + if (m_config_parse_config_file(conf, *cf, section, 0) < 0) { + r = false; + goto done; + } } if (encoding) @@ -134,7 +135,7 @@ static void mp_load_per_file_config(struct MPContext *mpctx) return; } - if ((confpath = mp_find_user_config_file(NULL, mpctx->global, name))) { + if ((confpath = mp_find_config_file(NULL, mpctx->global, name))) { try_load_config(mpctx, confpath, FILE_LOCAL_FLAGS); talloc_free(confpath); @@ -200,9 +201,13 @@ static char *mp_get_playback_resume_config_filename(struct mpv_global *global, for (int i = 0; i < 16; i++) conf = talloc_asprintf_append(conf, "%02X", md5[i]); - conf = talloc_asprintf(tmp, "%s/%s", MP_WATCH_LATER_CONF, conf); + res = talloc_asprintf(tmp, MP_WATCH_LATER_CONF "/%s", conf); + res = mp_find_config_file(NULL, global, res); - res = mp_find_user_config_file(NULL, global, conf); + if (!res) { + res = mp_find_config_file(tmp, global, MP_WATCH_LATER_CONF); + res = talloc_asprintf(NULL, "%s/%s", res, conf); + } exit: talloc_free(tmp); |