js: custom init: ignore ~~/.init.js with --no-config

The custom init script should be considered a configuration file, and
as such it should be ignored when the user wants vanilla mpv - and now
it is ignored with --no-config.
This commit is contained in:
Avi Halachmi (:avih) 2021-10-12 08:11:11 +03:00
parent a3ef4c62fc
commit f386fd79b2
2 changed files with 6 additions and 1 deletions

View File

@ -343,6 +343,8 @@ for all scripts. E.g. if it contains ``mp.module_paths.push("/foo")`` then
(do NOT do ``mp.module_paths = ["/foo"];`` because this will remove existing
paths - like ``<script-dir>/modules`` for scripts which load from a directory).
The custom-init file is ignored if mpv is invoked with ``--no-config``.
The event loop
--------------

View File

@ -773,5 +773,8 @@ g.mp_event_loop = function mp_event_loop() {
// let the user extend us, e.g. by adding items to mp.module_paths
// (unlike e.g. read_file, file_info doesn't expand meta-paths)
if (mp.utils.file_info(mp.utils.get_user_path("~~/.init.js")))
if (mp.get_property_bool("config") && // --no-config disables custom init
mp.utils.file_info(mp.utils.get_user_path("~~/.init.js")))
{
require("~~/.init");
}