summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAvi Halachmi (:avih) <avihpit@yahoo.com>2021-09-30 18:04:27 +0300
committerAvi Halachmi (:avih) <avihpit@yahoo.com>2021-09-30 18:28:28 +0300
commit6123e97e318122e128b4c034f897e8a82840a067 (patch)
treed723c3e67df07e5b1780c49dd8c7aad1040d7713
parent2d348980cbbb8a1d4f547c0cf5b09bd8d9208a0f (diff)
downloadmpv-6123e97e318122e128b4c034f897e8a82840a067.tar.bz2
mpv-6123e97e318122e128b4c034f897e8a82840a067.tar.xz
js: custom init (~~/.init.js): fail loudly on errors
Previously, loading ~~/.init.js was inside a try block, in order to quietly ignore errors if the file doesn't exist. However, that also prevented any real errors from showing up even when the file does exist, and the script continued as if everything is OK, while in fact the custom init script didn't complete correctly. Now we first check if the file exists, and then load it without try/catch, so that any error shows up normally (and abort the script).
-rw-r--r--player/javascript/defaults.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/player/javascript/defaults.js b/player/javascript/defaults.js
index 6a1c0762d4..4393925efe 100644
--- a/player/javascript/defaults.js
+++ b/player/javascript/defaults.js
@@ -771,7 +771,7 @@ g.mp_event_loop = function mp_event_loop() {
})(this)
-try {
- // let the user extend us, e.g. for updating mp.module_paths
+// 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")))
require("~~/.init");
-} catch(e) {}