path: don't load any files if --no-config is passed

`--no-config` should prevent loading any user files, whether it be
config, cache, watch_later state etc. This functionality was changed by
df758880e2 because internally `--no-config` is equivalent to passing
`--config-dir=""` which resulted in cache and state being auto-detected
even if `--no-config` was passed.

Fixes: df758880e2 ("path: don't override "cache" and "state" paths with configdir")
This commit is contained in:
llyyr 2024-03-04 17:30:28 +05:30 committed by sfan5
parent 0e5aa216b8
commit 084a8782e3
1 changed files with 5 additions and 1 deletions

View File

@ -76,10 +76,14 @@ static const char *mp_get_platform_path(void *talloc_ctx,
assert(talloc_ctx);
if (global->configdir) {
// Return NULL for all platform paths if --no-config is passed
if (!global->configdir[0])
return NULL;
// force all others to NULL, only first returns the path
for (int n = 0; n < MP_ARRAY_SIZE(config_dirs); n++) {
if (strcmp(config_dirs[n], type) == 0)
return (n == 0 && global->configdir[0]) ? global->configdir : NULL;
return (n == 0) ? global->configdir : NULL;
}
}