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.

有帮助吗?

解决方案

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");
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top