From 38b55c862fcf919428d8a7e0fd21b00b3aaf37c1 Mon Sep 17 00:00:00 2001 From: "Avi Halachmi (:avih)" Date: Thu, 30 Sep 2021 18:23:02 +0300 Subject: DOCS/javascript.rst: clarifications (file_info, custom init) --- DOCS/man/javascript.rst | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/DOCS/man/javascript.rst b/DOCS/man/javascript.rst index 6d4d207fbc..a8687ff692 100644 --- a/DOCS/man/javascript.rst +++ b/DOCS/man/javascript.rst @@ -179,7 +179,8 @@ success, ``fn`` is called always a-sync, ``error`` is empty string on success. ``mp.utils.readdir(path [, filter])`` (LE) -``mp.utils.file_info(path)`` (LE) +``mp.utils.file_info(path)`` (LE) Note: like lua - this does NOT expand +meta-paths like ``~~/foo`` (other JS file functions do expand meta paths). ``mp.utils.split_path(path)`` @@ -338,7 +339,9 @@ After mpv initializes the JavaScript environment for a script but before it loads the script - it tries to run the file ``.init.js`` at the root of the mpv configuration directory. Code at this file can update the environment further for all scripts. E.g. if it contains ``mp.module_paths.push("/foo")`` then -``require`` at all scripts will search global module id's also at ``/foo``. +``require`` at all scripts will search global module id's also at ``/foo`` +(do NOT do ``mp.module_paths = ["/foo"];`` because this will remove existing +paths - like ``/modules`` for scripts which load from a directory). The event loop -------------- -- cgit v1.2.3