Function nix::unistd::getcwd

source ·
pub fn getcwd() -> Result<PathBuf>
Expand description

Returns the current directory as a PathBuf

Err is returned if the current user doesn’t have the permission to read or search a component of the current path.

Example

use nix::unistd;

// assume that we are allowed to get current directory
let dir = unistd::getcwd().unwrap();
println!("The current directory is {:?}", dir);