Preopended directory suppport
Disk IO must be explicitly enabled in the TOML configuration
using directories.enabled = true
setting.
When enabled, the activity will be able to read and write to .
(guest current directory).
Example of listing the current directory:
fn ls() -> Vec<String> {
let mut entries = std::fs::read_dir(".")
.expect("read_dir failed")
.map(|res| res.map(|e| e.path().to_string_lossy().into_owned()))
.collect::<Result<Vec<_>, _>>()
.expect("iterating over folder failed");
entries.sort();
println!("ls:");
println!("{entries:?}");
entries
}
The TOML configuration contains more information on how to configure the host path and cleanup.
More examples are in directory test activity.