summaryrefslogtreecommitdiff
path: root/runtime/fs_util.rs
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/fs_util.rs')
-rw-r--r--runtime/fs_util.rs11
1 files changed, 5 insertions, 6 deletions
diff --git a/runtime/fs_util.rs b/runtime/fs_util.rs
index 02bcddd76..30598e041 100644
--- a/runtime/fs_util.rs
+++ b/runtime/fs_util.rs
@@ -21,16 +21,15 @@ pub fn canonicalize_path(path: &Path) -> Result<PathBuf, Error> {
Ok(canonicalized_path)
}
+#[inline]
pub fn resolve_from_cwd(path: &Path) -> Result<PathBuf, AnyError> {
- let resolved_path = if path.is_absolute() {
- path.to_owned()
+ if path.is_absolute() {
+ Ok(normalize_path(path))
} else {
let cwd =
current_dir().context("Failed to get current working directory")?;
- cwd.join(path)
- };
-
- Ok(normalize_path(&resolved_path))
+ Ok(normalize_path(&cwd.join(path)))
+ }
}
#[cfg(test)]