diff rust/hg-core/src/utils.rs @ 46542:2845892dd489

rust: Parse system and user configuration CLI `--config` argument parsing is still missing, as is per-repo config Differential Revision: https://phab.mercurial-scm.org/D9961
author Simon Sapin <simon.sapin@octobus.net>
date Thu, 04 Feb 2021 13:16:21 +0100
parents ca3f73cc3cf4
children a25033eb43b5
line wrap: on
line diff
--- a/rust/hg-core/src/utils.rs	Mon Feb 01 13:32:00 2021 +0100
+++ b/rust/hg-core/src/utils.rs	Thu Feb 04 13:16:21 2021 +0100
@@ -184,3 +184,10 @@
         context: IoErrorContext::CurrentDir,
     })
 }
+
+pub fn current_exe() -> Result<std::path::PathBuf, HgError> {
+    std::env::current_exe().map_err(|error| HgError::IoError {
+        error,
+        context: IoErrorContext::CurrentExe,
+    })
+}