Fix licence and restructure, prepare to add AudioWorklet

This commit is contained in:
msqr1
2024-01-20 17:37:47 -08:00
parent 6bc5f4061d
commit 6da9a662a1
14 changed files with 94 additions and 104 deletions

View File

@@ -21,23 +21,23 @@ bool genericModel::loadModel(const std::string& storepath) {
char filename[] {"/opfs/XXXXXX.tzst"};
close(mkostemps(filename, 5, O_PATH));
if(emscripten_wget(url.c_str(),filename) == 1) {
throwErr("Unable to fetch model");
throwJS("Unable to fetch model");
return false;
}
if(!extractModel(filename)) {
throwErr("Unable to extract model");
throwJS("Unable to extract model");
return false;
}
fs::remove(filename);
if(!checkModel()) {
throwErr("Model URL contains invalid model files");
throwJS("Model URL contains invalid model files");
fs::current_path("/opfs");
fs::remove_all(storepath);
return false;
}
std::ofstream idFile("id");
if(!idFile.is_open()) {
throwErr("Unable to write new id");
throwJS("Unable to write new id");
fs::remove_all(storepath);
return false;
}