axstd/env.rs
1//! Inspection and manipulation of the process’s environment.
2
3#[cfg(feature = "fs")]
4extern crate alloc;
5
6#[cfg(feature = "fs")]
7use {crate::io, alloc::string::String};
8
9/// Returns the current working directory as a [`String`].
10#[cfg(feature = "fs")]
11pub fn current_dir() -> io::Result<String> {
12 arceos_api::fs::ax_current_dir()
13}
14
15/// Changes the current working directory to the specified path.
16#[cfg(feature = "fs")]
17pub fn set_current_dir(path: &str) -> io::Result<()> {
18 arceos_api::fs::ax_set_current_dir(path)
19}