summaryrefslogtreecommitdiffstats
path: root/options/path.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-02-14 13:52:59 +0100
committerwm4 <wm4@nowhere>2014-02-14 14:01:27 +0100
commitce6fb9175c104113396949f50364b0a49d69c9c6 (patch)
tree1c52dbb5cdf34d53506b497404ac4ab2c17fd655 /options/path.c
parentc2e8f8fb89efe82a653832ba31ce74a5ff431c12 (diff)
downloadmpv-ce6fb9175c104113396949f50364b0a49d69c9c6.tar.bz2
mpv-ce6fb9175c104113396949f50364b0a49d69c9c6.tar.xz
options: make --no-config block all auto-loaded configuration files
Until now, the --no-config was explicitly checked in multiple places to suppress loading of config files. Add such a check to the config path code itself, and refuse to resolve _any_ configuration file locations if the option is set. osc.lua needs a small fixup, because it didn't handle the situation when no path was returned. There may some of such cases in the C code too, but I didn't find any on a quick look.
Diffstat (limited to 'options/path.c')
-rw-r--r--options/path.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/options/path.c b/options/path.c
index 94b599803e..5fb20010cf 100644
--- a/options/path.c
+++ b/options/path.c
@@ -32,9 +32,12 @@
#include <sys/stat.h>
#include <unistd.h>
#include <errno.h>
+
#include "config.h"
+
#include "common/global.h"
#include "common/msg.h"
+#include "options/options.h"
#include "options/path.h"
#include "talloc.h"
#include "osdep/io.h"
@@ -53,6 +56,10 @@ static const lookup_fun config_lookup_functions[] = {
char *mp_find_config_file(void *talloc_ctx, struct mpv_global *global,
const char *filename)
{
+ struct MPOpts *opts = global->opts;
+ if (!opts->load_config)
+ return NULL;
+
for (int i = 0; config_lookup_functions[i] != NULL; i++) {
char *path = config_lookup_functions[i](talloc_ctx, global, filename);
if (!path) continue;
@@ -68,6 +75,10 @@ char *mp_find_config_file(void *talloc_ctx, struct mpv_global *global,
char *mp_find_user_config_file(void *talloc_ctx, struct mpv_global *global,
const char *filename)
{
+ struct MPOpts *opts = global->opts;
+ if (!opts->load_config)
+ return NULL;
+
char *homedir = getenv("MPV_HOME");
char *configdir = NULL;
char *result = NULL;