diff --git a/src/host-web/chucknode-postjs.js b/src/host-web/chucknode-postjs.js index 9a39088d7..5343afabb 100644 --- a/src/host-web/chucknode-postjs.js +++ b/src/host-web/chucknode-postjs.js @@ -509,8 +509,18 @@ class ChuckNode extends AudioWorkletProcessor { return function() { - // Create a directory for chugins - Module["FS_createPath"]("/", "chugins", true, true); + // Create directories required to load filesToPreload + const dirs = filesToPreload.map((f) => { + const path = f.filename.split("/"); + return path.slice(0, path.length - 1); + }); + + dirs.forEach((dir) => + dir.reduce((parent, name) => { + Module["FS_createPath"](parent, name, true, true); + return parent + "/" + name; + }, '/') + ); // Preload files into the file system for( var i = 0; i < filesToPreload.length; i++ )