From a27aa68dd33c613218d261b14ef1cf763abc1c33 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 15 Feb 2015 14:28:49 +0100 Subject: player: undeprecate 'config' files Actually, it's pretty simple to look for multiple filenames at once, since mp_find_all_config_files() is already a bit "special" anyway. See #1569. Reverts most of commit db167cd4 (keeps osx-bundle.conf). --- options/path.c | 15 +++++++++------ options/path.h | 3 ++- 2 files changed, 11 insertions(+), 7 deletions(-) (limited to 'options') diff --git a/options/path.c b/options/path.c index 5783e2e549..6ae0fc4d11 100644 --- a/options/path.c +++ b/options/path.c @@ -147,12 +147,15 @@ char **mp_find_all_config_files(void *talloc_ctx, struct mpv_global *global, char **dirs = mp_config_dirs(NULL, global); for (int i = 0; dirs && dirs[i]; i++) { - char *file = talloc_asprintf(ret, "%s/%s", dirs[i], filename); - - if (!mp_path_exists(file) || num_ret >= MAX_CONFIG_PATHS) - continue; - - ret[num_ret++] = file; + bstr s = bstr0(filename); + while (s.len) { + bstr fn; + bstr_split_tok(s, "|", &fn, &s); + + char *file = talloc_asprintf(ret, "%s/%.*s", dirs[i], BSTR_P(fn)); + if (mp_path_exists(file) && num_ret < MAX_CONFIG_PATHS) + ret[num_ret++] = file; + } } talloc_free(dirs); diff --git a/options/path.h b/options/path.h index 6e64cd1d3c..44c3489396 100644 --- a/options/path.h +++ b/options/path.h @@ -33,7 +33,8 @@ char *mp_find_config_file(void *talloc_ctx, struct mpv_global *global, const char *filename); // Find all instances of the given config file. Paths are returned in order -// from lowest to highest priority. +// from lowest to highest priority. filename can contain multiple names +// separated with '|', with the first having highest priority. char **mp_find_all_config_files(void *talloc_ctx, struct mpv_global *global, const char *filename); -- cgit v1.2.3