Function typed_path::utils::current_dir
source · pub fn current_dir() -> Result<NativePathBuf>Expand description
Returns the current working directory as NativePathBuf.
Errors
Returns an Err if the current working directory value is invalid
or unable to parse the directory with the native encoding.
Possible cases:
- Current directory does not exist.
- There are insufficient permissions to access the current directory.
- The encoding used to parse the current directory failed to parse.
Examples
fn main() -> std::io::Result<()> {
let path = typed_path::utils::current_dir()?;
println!("The current directory is {}", path.display());
Ok(())
}