pub fn utf8_current_dir() -> Result<Utf8PlatformPathBuf>
Expand description
Returns the current working directory as Utf8PlatformPathBuf
.
§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.
- The current directory was not valid UTF8.
§Examples
fn main() -> std::io::Result<()> {
let path = typed_path::utils::utf8_current_dir()?;
println!("The current directory is {}", path);
Ok(())
}