Function std::os::getcwdExperimental
[-]
[+]
[src]
pub fn getcwd() -> IoResult<Path>
Returns the current working directory as a Path
.
Errors
Returns an Err
if the current working directory value is invalid.
Possible cases:
- Current directory does not exist.
- There are insufficient permissions to access the current directory.
- The internal buffer is not large enough to hold the path.
Example
fn main() { use std::os; // We assume that we are in a valid directory. let current_working_directory = os::getcwd().unwrap(); println!("The current directory is {}", current_working_directory.display()); }use std::os; // We assume that we are in a valid directory. let current_working_directory = os::getcwd().unwrap(); println!("The current directory is {}", current_working_directory.display());