diff options
Diffstat (limited to 'cli/deno_dir.rs')
-rw-r--r-- | cli/deno_dir.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/cli/deno_dir.rs b/cli/deno_dir.rs index 4bca1117a..9d83ad044 100644 --- a/cli/deno_dir.rs +++ b/cli/deno_dir.rs @@ -896,6 +896,14 @@ pub fn resolve_file_url( Ok(j) } +pub fn resolve_path(path: &str) -> Result<(PathBuf, String), DenoError> { + let url = resolve_file_url(path.to_string(), ".".to_string()) + .map_err(DenoError::from)?; + let path = url.to_file_path().unwrap(); + let path_string = path.to_str().unwrap().to_string(); + Ok((path, path_string)) +} + #[cfg(test)] mod tests { use super::*; |