Function nix::unistd::getcwd [] [src]

pub fn getcwd() -> Result<PathBuf>

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

extern crate nix;

use nix::unistd;

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