Brief description of the issue:
From within a WASM gauge, I am unable to open the
\work directories or create any files under
\work. The particular error reported indicates:
failed to find a pre-opened file descriptor through which “\work” could be opened
This appears to be due to no file descriptors being returned during the call to the WASI
Provide Screenshot(s)/video(s) of the issue encountered:
\\ instead of
\ in the error report is just an implementation detail of how the debug print works on paths. The path being passed has only the one
Detail steps to reproduce the issue encountered:
Download the Working Title CJ4 mod, extract into the
SimObjects\Airplanes\Asobo_CJ4\panel\workingtitle-cj4-wasm.wasmwith this WASM build artifact (you will need to rename it to
layout.jsonfile for the module to indicate a larger size for this file. I have been using 200000.
Load up the Sim and open the console.
On loading into the CJ4, the module will attempt to find/access directories and create a file from a variety of paths and report the result of those requests to the console, but will fail.
Note: This does involve use of the Rust compiler, however this is the first incompatibility I’ve found. The actual error is being generated by this bit of code inside the standard library, which receives
-1 back as the file descriptor after calling
I have confirmed that the
\work directories are already pre-opened as file descriptors 3 and 4 by using the bare
fd_prestat_dir_name APIs. That just leads me to believe that it is this
find_relpath call that is not returning the pre-opened FD which is the issue.