-
Notifications
You must be signed in to change notification settings - Fork 839
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
--mapdir flag #458
Labels
🎉 enhancement
New feature!
Comments
Thanks -- we're glad to hear that! This is a great idea and we agree it's super nice to have! I've started work on it in #451 actually, but am blocked by myself (well, due to mysterious CI issues) setting up tests (#457). I wanted to have more confidence that I wasn't breaking core features before shipping/continuing development on it. |
Awesome! Look forward to it! |
bors bot
added a commit
that referenced
this issue
May 21, 2019
451: implement map-dir for WASI; fix bug in path_open r=MarkMcCaskey a=MarkMcCaskey Colon separated mapping, implemented to be compatible with wasmtime resolves #458 example: ```Rust use std::fs; fn main() { let read_dir = fs::read_dir(".").unwrap(); for entry in read_dir { println!("{:?}", entry.unwrap().path()); } } ``` ```shell $ cargo run --release --bin wasmer -- run --mapdir=.:src list-files.wasm "./bin" "./installer" "./lib" "./update" "./utils" "./webassembly" ``` Co-authored-by: Mark McCaskey <[email protected]> Co-authored-by: Mark McCaskey <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Great stuff! I've been implementing my own Wasi library in Assemblyscript and have had some initial successes using wasmer!
Motivation
It would be nice for end users if their initial directory path was root, "/" instead of either a fullpath or ".".
Wasmtime has this option so that you can map an external pathname to an internal one.
e.g.
--mapdir=/tmp:/var/tmp
Proposed solution
Add command line option and open directories on the host with the path left of the ":" and name it with the left half in the runtime.
Currently this is done here.
Wasmtime does it here
Alternatives
One alternative is to just interpret each path as a mapped directory if there is a ":" in the name. This seems like the faster way, but it would be better if the API reflected the difference.
The text was updated successfully, but these errors were encountered: