Commit a863d6b2 authored by Romain Casati's avatar Romain Casati

Exposes get_file to JS and implements get_user_module_file (+ JS).

parent 65314a14
......@@ -310,6 +310,20 @@
}
};
/**
* Download a file from the VFS.
*/
that.getFile = function (path) {
return pyodide.globals.basthon.kernel.get_file(path);
};
/**
* Download a user module file.
*/
that.getUserModuleFile = function (filename) {
return pyodide.globals.basthon.kernel.get_user_module_file(filename);
};
/**
* Is the source ready to be evaluated or want we more?
* Usefull to set ps1/ps2 for teminal prompt.
......
......@@ -120,6 +120,14 @@ def get_file(filepath):
window.Basthon.download(f.read(), filename)
def get_user_module_file(filename):
"""
Download a module (*.py) put in the user modules directory
(via put_module).
"""
return get_file(os.path.join(_user_modules_root, filename))
def importables():
""" List of all importable modules. """
import sys
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment