1
0
mirror of https://github.com/mpv-player/mpv synced 2025-01-03 05:22:23 +00:00

options: don't load per-file config files by default

Generally useless feature, and might be slightly dangerous if paths
can "escape" from the profile dir. (Normally this shouldn't be
possible, though.)
This commit is contained in:
wm4 2014-10-17 02:55:31 +02:00
parent 41b2927f39
commit 01e1d0948d
2 changed files with 13 additions and 13 deletions

View File

@ -356,7 +356,7 @@ You can also write file-specific configuration files. If you wish to have a
configuration file for a file called 'video.avi', create a file named
'video.avi.conf' with the file-specific options in it and put it in
``~/.config/mpv/``. You can also put the configuration file in the same directory
as the file to be played, as long as you give the ``--use-filedir-conf``
as the file to be played. Both require you to set the ``--use-filedir-conf``
option (either on the command line or in your global config file). If a
file-specific configuration file is found in the same directory, no
file-specific configuration is loaded from ``~/.config/mpv``. In addition, the

View File

@ -111,15 +111,15 @@ static void mp_load_per_file_config(struct MPContext *mpctx)
char cfg[512];
const char *file = mpctx->filename;
if (opts->use_filedir_conf) {
if (snprintf(cfg, sizeof(cfg), "%s.conf", file) >= sizeof(cfg)) {
MP_VERBOSE(mpctx, "Filename is too long, "
"can not load file or directory specific config files\n");
MP_VERBOSE(mpctx, "Filename is too long, can not load file or "
"directory specific config files\n");
return;
}
char *name = mp_basename(cfg);
if (opts->use_filedir_conf) {
bstr dir = mp_dirname(cfg);
char *dircfg = mp_path_join(NULL, dir, bstr0("mpv.conf"));
try_load_config(mpctx, dircfg, FILE_LOCAL_FLAGS);
@ -127,13 +127,13 @@ static void mp_load_per_file_config(struct MPContext *mpctx)
if (try_load_config(mpctx, cfg, FILE_LOCAL_FLAGS))
return;
}
if ((confpath = mp_find_config_file(NULL, mpctx->global, name))) {
try_load_config(mpctx, confpath, FILE_LOCAL_FLAGS);
talloc_free(confpath);
}
}
}
static void mp_auto_load_profile(struct MPContext *mpctx, char *category,