Skip to content

Commit

Permalink
Merge pull request #458 from qlambert-pro/preloadFilesInDirectories
Browse files Browse the repository at this point in the history
create the directory hierarchy necessary to preload the different files in webchuck
  • Loading branch information
gewang authored Aug 30, 2024
2 parents 05c77a9 + fe9d1d8 commit d346611
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/host-web/chucknode-postjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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++ )
Expand Down

0 comments on commit d346611

Please sign in to comment.