diff -r 6c778d20c8c2 -r ca3f73cc3cf4 rust/hg-core/src/utils.rs --- a/rust/hg-core/src/utils.rs Thu Jan 28 19:21:57 2021 +0100 +++ b/rust/hg-core/src/utils.rs Thu Jan 28 19:13:55 2021 +0100 @@ -7,6 +7,7 @@ //! Contains useful functions, traits, structs, etc. for use in core. +use crate::errors::{HgError, IoErrorContext}; use crate::utils::hg_path::HgPath; use std::{io::Write, ops::Deref}; @@ -176,3 +177,10 @@ None } } + +pub fn current_dir() -> Result { + std::env::current_dir().map_err(|error| HgError::IoError { + error, + context: IoErrorContext::CurrentDir, + }) +}