Merge worker.js file so this truly has one file, status: tested, not working

This commit is contained in:
msqr1
2024-02-01 17:04:43 -08:00
parent 9d21692993
commit 9f49aa46e0
12 changed files with 466 additions and 238 deletions

View File

@@ -1,13 +1,22 @@
#include "genericModel.h"
genericModel::genericModel(const std::string& storepath, const std::string &id, int index) : storepath(storepath), id(id), index(index) {
fs::current_path("/opfs");
fs::create_directories(storepath);
fs::current_path(storepath);
fs::current_path("/opfs", tank);
if(tank.value() != 0) {
throwJS("Unable to change to OPFS directory");
return;
}
if(!fs::create_directories(storepath, tank)) {
throwJS("Unable to make model directory");
return;
};
fs::current_path(storepath, tank);
if(tank.value() != 0) {
throwJS("Unable to change to model directory");
}
}
bool genericModel::checkModel() {
if(!checkModelFiles()) return false;
static std::error_code c{};
if(!fs::exists("id", c)) return false;
if(!fs::exists("id", tank)) return false;
std::ifstream file {"id", std::ifstream::binary};
if(!file.is_open()) return false;
long long size {file.seekg(0, std::ios::end).tellg()};