diff --git a/crates/wasi-common/src/ctx.rs b/crates/wasi-common/src/ctx.rs index f99a9f7ed6..b4b3a55324 100644 --- a/crates/wasi-common/src/ctx.rs +++ b/crates/wasi-common/src/ctx.rs @@ -43,6 +43,10 @@ impl WasiCtx { .insert_at(fd, Box::new(FileEntry::new(caps, file))); } + pub fn push_file(&mut self, file: Box, caps: FileCaps) -> Result { + self.table().push(Box::new(FileEntry::new(caps, file))) + } + pub fn insert_dir( &mut self, fd: u32, @@ -57,6 +61,17 @@ impl WasiCtx { ); } + pub fn push_dir( + &mut self, + dir: Box, + caps: DirCaps, + file_caps: FileCaps, + path: PathBuf, + ) -> Result { + self.table() + .push(Box::new(DirEntry::new(caps, file_caps, Some(path), dir))) + } + pub fn table(&mut self) -> &mut Table { &mut self.table }