Pregunta

If I have a chrome packaged app that also includes a PNaCl/NaCl module, is there a way to include in the packaged app some data files, which the NaCl module will then read in?

I don't need to do any file writing, just to include some data files that the native module needs to make use of.

¿Fue útil?

Solución

The entire contents of your packaged app are available to both JavaScript and NaCl code via http requests.

If you use the nacl_io library then you can also access all the files using standard POSIX file APIs by first mounting the contents of the package somewhere if your virtual filesystem:

e.g:

// Mount the http root at /mnt/package/
mount("/", "/mnt/package/", "httpfs", 0, "");
FILE* f = fopen("/mnt/package/somefile", "r");
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top