From daf7617f42e2e7520344ec98db3d60016b85fd73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Wed, 26 Feb 2020 22:11:52 +0100 Subject: rewrite normalize_path (#4143) Rewrite "normalize_path()" to remove all intermediate components from the path, ie. "./" and "../". It's very similar in functionality to fs::canonicalize(), however "normalize_path() doesn't resolve symlinks. --- cli/ops/runtime.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cli/ops') diff --git a/cli/ops/runtime.rs b/cli/ops/runtime.rs index a888ce9a8..ecdb82fd9 100644 --- a/cli/ops/runtime.rs +++ b/cli/ops/runtime.rs @@ -1,7 +1,6 @@ // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. use super::dispatch_json::{JsonOp, Value}; use crate::colors; -use crate::fs as deno_fs; use crate::op_error::OpError; use crate::state::State; use crate::version; @@ -33,7 +32,8 @@ fn op_start( let gs = &state.global_state; Ok(JsonOp::Sync(json!({ - "cwd": deno_fs::normalize_path(&env::current_dir().unwrap()), + // TODO(bartlomieju): `cwd` field is not used in JS, remove? + "cwd": &env::current_dir().unwrap(), "pid": std::process::id(), "args": gs.flags.argv.clone(), "repl": gs.flags.subcommand == DenoSubcommand::Repl, -- cgit v1.2.3