pub fn current_dir() -> Result<PlatformPathBuf>
Expand description
Returns the current working directory as PlatformPathBuf
.
§Errors
Returns an Err
if the current working directory value is invalid
or unable to parse the directory with the platform 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(())
}