summaryrefslogtreecommitdiff
path: root/cli/ops.rs
diff options
context:
space:
mode:
authorKevin (Kun) "Kassimo" Qian <kevinkassimo@gmail.com>2019-05-09 09:20:34 -0700
committerRyan Dahl <ry@tinyclouds.org>2019-05-09 12:20:34 -0400
commitd9cdc6788b1ed89d7f3b2daf9da7e4a9f664e424 (patch)
tree8b007590b9bf39c7292355dd5b0f3a41b5d1c0a5 /cli/ops.rs
parent2edee3367dc9003b721cf87ca57e820c7acf7b25 (diff)
fix: support relative path for whitelisting (#2317)
Using `std::fs::canonicalize` to expand path to full existing path, such that later attempt to loop-pop and compare path segment would work.
Diffstat (limited to 'cli/ops.rs')
-rw-r--r--cli/ops.rs10
1 files changed, 1 insertions, 9 deletions
diff --git a/cli/ops.rs b/cli/ops.rs
index a1d6e0c48..610304aea 100644
--- a/cli/ops.rs
+++ b/cli/ops.rs
@@ -2,7 +2,7 @@
use atty;
use crate::ansi;
use crate::compiler::get_compiler_config;
-use crate::deno_dir;
+use crate::deno_dir::resolve_path;
use crate::dispatch_minimal::dispatch_minimal;
use crate::dispatch_minimal::parse_min_record;
use crate::errors;
@@ -241,14 +241,6 @@ pub fn op_selector_std(inner_type: msg::Any) -> Option<OpCreator> {
}
}
-fn resolve_path(path: &str) -> Result<(PathBuf, String), DenoError> {
- let url = deno_dir::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))
-}
-
// Returns a milliseconds and nanoseconds subsec
// since the start time of the deno runtime.
// If the High precision flag is not set, the