-
Has anybody attempted to allow WASI file access when embedding WAMR in C/C++ code? Because when i try to run a simple Rust program that opens a file and reads its contents compiled with: Source files: |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
@m1cha1s unfortunately your |
Beta Was this translation helpful? Give feedback.
-
@m1cha1s WASI is built using capability-based security principles, to access the file under the folder, normally we should grant the acess privileges for the folder. For the |
Beta Was this translation helpful? Give feedback.
@m1cha1s unfortunately your
test.cpp
only containsHello world
text.Answering your question: your WASM code runs in sandboxing environment, therefore any I/O access must be explicitly granted. To enable access to specific directories, you can use the
wasm_runtime_set_wasi_args
(second argument in that function is a list of directories that should be allowed, and the third one is the size of the list).