Function std::os::getcwd[src]

pub fn getcwd() -> Path

Returns the current working directory as a Path.

Failure

Fails if the current working directory value is invalid: Possibles cases:

Example

fn main() { use std::os; // We assume that we are in a valid directory like "/home". let current_working_directory = os::getcwd(); println!("The current directory is {}", current_working_directory.display()); // /home }
use std::os;

// We assume that we are in a valid directory like "/home".
let current_working_directory = os::getcwd();
println!("The current directory is {}", current_working_directory.display());
// /home