Paths for panel.cfg .wasm files?

Hi, Can anyone clarify if/how I can specify a PATH in my panel.cfg to my
wasm_module? If so it would be helpful to know if those file paths have a root
(the base of the package?) or whether the path needs to be relative My wasm
gauge module is working fine stored in the aircraft panel/ folder, but it
would be more convenient to me to have it stored in the same folder as an
associated html/js gauge. The current panel.cfg entry is:

htmlgauge06=WasmInstrument/WasmInstrument.html?wasm_module=file_read.wasm&wasm;_gauge=file_read,0,0,1,1

but as mentioned I’d like to move the file_read.wasm to a different directory
(actually in the html_ui tree) - is that possible? I tried what I thought
might be the simplest test by moving the wasm gauge into the ‘model’ folder
and modified the panel.cfg to

htmlgauge06=WasmInstrument/WasmInstrument.html?wasm_module=model/file_read.wasm&wasm;_gauge=file_read,0,0,1,1

but that seemed not to work. The wasm gauge is required because I need to read
a package file (e.g. aircraft.cfg). Read file access is available to the whole
package for WASM gauges and AFAIK only the html_ui tree for the html/js
gauges, which seems an unnecessary quirk. Probably only affecting me though.

A related question to the above is what is the current directory for file
operations from the file_read.wasm gauge i.e. if it
fopen("myfile.txt","r") then which directory would that “myfile.txt” be
opened from? I’ve tried going up a directory with fopen("..\\\myfile.txt")
but that doesn’t seem to work.

Make an asset for wasm files and call the folder Wasm. Then I call to the wasm
files from the panel.cfg entries like this.
===================================================== The Wasm is the folder
name and the Wasm file name is the end part. Wasm… /…
_C414_Mixture_Controller.wasm &wasm;gauge=FdGauge

[Vcockpit13]
size_mm=0,0
pixel_size=0,0
texture=NONE
htmlgauge00=WasmInstrument/WasmInstrument.html?wasm_module=Wasm/C414_Mixture_Controller.wasm&wasm;_gauge=FdGauge,0,0,1,1

Thanks - I’m assuming that ‘Wasm’ folder ends up next to SimObjects on the
Package VFS. I’ll test to see if html_ui/Pages/myaircraft/ works. I need a
wasm gauge and a html gauge to read the same settings file, and html gauges
can only read files in the html_ui tree. I’m trying to see if I can place the
wasm gauge and the html gauge together (the WASM is actually just a
SimObjects/ file read shim needed by the html gauge).

To answer my own question: The panel.cfg entry for

htmlgaugeXX = WasmInstrument/WasmInstrument.html?wasm_module=&...

uses a slightly counter-intuitive path for the wasm module. IF the filepath is
a simple filename, then that wasm file can be placed in the same folder as the
panel.cfg (i.e. the aircraft panel folder), i.e. there seems to be a basic
concept of ‘local directory’ being the panel folder and relative paths would
be from that but this is misleading. Otherwise the path to the wasm file will
be evaluated from the root of your package. Because my WASM gauge is actually
adding small additional function to a larger and more complex html/js gauge
(supporting reading aircraft files in the SimObjects folders) it makes sense
for me to co-locate the .html, .css, .js and .wasm components of the gauge,
necessarily in the html_ui branch of the package tree as the html/js requires
that. So this entry works for me in the panel.cfg:

htmlgauge06 = WasmInstrument/WasmInstrument.html?wasm_module=html_ui/Pages/VCockpit/Instruments/AS-33/b21_soaring_engine/b21_soaring_engine.wasm&wasm;_gauge=fcheck,0,0,1,1

Bonus answer: If you’re reading aircraft files with WASM it seems ‘relative’
file access isn’t possible and you access files from the root of the package
tree. This means to find e.g. the aircraft.cfg you need to specify a
SimObjects path with your unique aircraft reference embedded in the filepath.
If this is hardcoded into the WASM then that gauge will not be portable to
other aircraft. Here’s the C++ function I use to automatically generate the
path to the current aircraft folder:

#include 
char simobjects_path[1000]; // Aircraft name used in package SimObjects folder
void get_package_refs() {
    strcpy(simobjects_path, "\\SimObjects\\Airplanes\\");
    struct dirent* entry;
    DIR* dir = opendir(simobjects_path);
    if (dir == NULL) {
        fprintf(stderr, "B21 fcheck Airplanes folder not found");
        return;
    }
    while ((entry = readdir(dir)) != NULL) {
        fprintf(stderr, "B21 fcheck Airplanes\\%s\n", entry->d_name);
        if (entry->d_name[0] != '.') {
            strcat(simobjects_path, entry->d_name);
            strcat(simobjects_path, "\\");
            break;
        }
    }
    closedir(dir);
    fprintf(stderr, "B21 fcheck SimObjects path is '%s'", simobjects_path);
}

For my aircraft this function “get_package_refs” will return with:

simobjects_path  = "\SimObjects\Airplanes\AS-33\";

So I can easily create a path to e.g. the “aircraft.cfg” file and my wasm code
is portable. In my real code I also calculate the similar path into the
html_ui Instruments tree. The function assumes both the “Airplanes” and the
“Instruments” directories only contain one entry.