File System Emulation

I'm trying to get a file system emulation POC going. https://docs.leaningtech.com/cheerp/Filesystem-emulation
The core of my new code for this is as simple as that doc page:

[[cheerp::genericjs]]
void preloadCallback()
{
    // Files are ready
    //Window *fd = open("assets/tstcweb.scr");
    client::console.log("Hello, files loaded.");
    //client::console.log(fd);
}

cheerp::FilePreloader files(preloadCallback, "tstcweb.scr");


I get this in the browser js console:

Uncaught (in promise) Error: this should be unreachable

    __dummy http://localhost:8000/xlink_cheerp_wasm.js:271

    __start http://localhost:8000/xlink_cheerp_wasm.js:251

    promise http://localhost:8000/xlink_cheerp_wasm.js:331

    promise callback* http://localhost:8000/xlink_cheerp_wasm.js:302


I'm not sure exactly which version of cheerp I have. It's a windows installer support gave me that includes file system emulation.

The `tstcweb.scr' is a plain text file I have at the root of my cheerp project, though I also tried putting it in an assets subfolder. Note that the open() call is commented out -- it's not making it that far. Is there something that needs to be done to include such files in the package given to the browser?
docs.leaningtech.com
Cheerp is the enterprise-grade C/C++ compiler for the Web and can compile C/C++ into WebAssembly and JavaScript.
Was this page helpful?