Function typed_path::utils::utf8_current_dir

source ·
pub fn utf8_current_dir() -> Result<Utf8NativePathBuf>
Expand description

Returns the current working directory as Utf8NativePathBuf.

§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.
  • 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(())
}