wasmer_wasix/journal/effector/syscalls/
chdir.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use super::*;

impl JournalEffector {
    pub fn save_chdir(ctx: &mut FunctionEnvMut<'_, WasiEnv>, path: String) -> anyhow::Result<()> {
        Self::save_event(ctx, JournalEntry::ChangeDirectoryV1 { path: path.into() })
    }

    pub fn apply_chdir(ctx: &mut FunctionEnvMut<'_, WasiEnv>, path: &str) -> anyhow::Result<()> {
        crate::syscalls::chdir_internal(ctx, path).map_err(|err| {
            anyhow::format_err!(
                "snapshot restore error: failed to change directory (path={}) - {}",
                path,
                err
            )
        })?;
        Ok(())
    }
}