use mkdirTree in emscripten FS (#1245)

* try mkdirTree

* suggested changes

* fix pre-commit
This commit is contained in:
Madhur Tandon
2023-03-04 18:48:01 +05:30
committed by GitHub
parent 4483f0db0f
commit 3033c779b0
2 changed files with 23 additions and 45 deletions

View File

@@ -248,6 +248,7 @@ export class PyScriptApp {
// initialized. But we could easily do it in JS in parallel with the
// download/startup of pyodide.
const [paths, fetchPaths] = calculatePaths(this.config.fetch);
logger.info('Paths to write: ', paths);
logger.info('Paths to fetch: ', fetchPaths);
for (let i = 0; i < paths.length; i++) {
logger.info(` fetching path: ${fetchPaths[i]}`);
@@ -332,8 +333,7 @@ export class PyScriptApp {
const pathArr = filePath.split('/');
const filename = pathArr.pop();
// TODO: Would be probably be better to store plugins somewhere like /plugins/python/ or similar
const destPath = `./${filename}`;
await interpreter._remote.loadFromFile(destPath, filePath);
await interpreter._remote.loadFromFile(filename, filePath);
//refresh module cache before trying to import module files into interpreter
interpreter._remote.invalidate_module_path_cache();