I think it should work as you expect. For example,
#include <stdio.h>
int main() {
printf("%p\n", fopen("src/webGLWorker.js", "rb"));
}
built with
./emcc a.cpp --preload-file src/ -o a.html
in the emscripten root directory will succeed to fopen that file (which
indeed exists under src/).
You can inspect the output JS file to see the preloaded file code. For
example in the output from that command, it contains this metadata for that
file that is opened:
{"start": 2376860, "audio": 0, "end": 2419578, "filename":
"/src/webGLWorker.js"}
Some possible issues might be if you are in another directory, or the
preloading failed due to a network error, etc. (can use the network tab in
devtools to debug stuff like this).
- Alon
On Sat, Jul 20, 2019 at 1:28 PM キャロウ マーク <[email protected]> wrote:
>
>
> > On Jul 20, 2019, at 10:15, キャロウ マーク <[email protected]> wrote:
> >
> > I have —preload-file testimages on my emcc command. testimages is a
> directory of images. I am trying to load these in my app with, e.g,
> fopen(”testimages/image.ktx2”, …). The open is failing. I am wondering if
> perhaps the files are being put into MEMFS without the testimages parent
> directory. I have not found any documentation beyond the very simple
> example in the tutorial which only pre-loads a single file. So no help
> there.
> >
>
> If my reading of the packaging documentation is correct, “testimages/foo”
> should be readable as “testimages/foo” in the MEMFS. However I am getting
> file not found error. How can I list the files that have been included in
> the .data file after compilation? I’m sure there used to be a way when I
> was using Emscripten a few years ago but I couldn’t find any mention in the
> documentation now.
>
> Regards
>
> -Mark
>
> --
> You received this message because you are subscribed to the Google Groups
> "emscripten-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/emscripten-discuss/AEC53EAA-17D6-4CF6-B4B2-9B41D3077DCE%40callow.im
> .
>
--
You received this message because you are subscribed to the Google Groups
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/emscripten-discuss/CAEX4NpRtT2O%3DQMp4WzERNAiHyE7B4GioisjSvcD9dBi2HfHR6A%40mail.gmail.com.