init zbox first

This commit is contained in:
Lachlan Sneff 2019-04-01 17:25:45 -07:00
parent d164c7a93b
commit 8bab9f1bea

View File

@ -10,8 +10,9 @@ use std::{
ops::{Index, IndexMut}, ops::{Index, IndexMut},
rc::Rc, rc::Rc,
time::SystemTime, time::SystemTime,
path::PathBuf,
}; };
use zbox::{File, FileType, OpenOptions, Repo, RepoOpener}; use zbox::{File, FileType, OpenOptions, Repo, RepoOpener, init_env as zbox_init_env};
pub const MAX_SYMLINKS: usize = 100; pub const MAX_SYMLINKS: usize = 100;
@ -57,10 +58,11 @@ pub struct WasiFs {
impl WasiFs { impl WasiFs {
pub fn new() -> Result<Self, String> { pub fn new() -> Result<Self, String> {
zbox_init_env();
Ok(Self { Ok(Self {
repo: RepoOpener::new() repo: RepoOpener::new()
.create(true) .create(true)
.open("mem://not-an-emoji", "very unsafe pwd") .open("mem://foo", "")
.map_err(|e| e.to_string())?, .map_err(|e| e.to_string())?,
name_map: HashMap::new(), name_map: HashMap::new(),
inodes: Arena::new(), inodes: Arena::new(),