문제

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