summaryrefslogtreecommitdiff
path: root/cli/ops/fs.rs
diff options
context:
space:
mode:
authorNayeem Rahman <nayeemrmn99@gmail.com>2020-10-30 02:19:03 +0000
committerGitHub <noreply@github.com>2020-10-30 03:19:03 +0100
commit6be6c517d0691bf1d14eef67668e575c84cdfdf4 (patch)
treefd6b37f2807f78325a08fff5e34166d6eec84ca7 /cli/ops/fs.rs
parent1854c6f73be9d4439807911ce9cba1125af93dd4 (diff)
fix(cli/fmt): Strip "\\?\" prefix when displaying Windows paths (#8135)
Diffstat (limited to 'cli/ops/fs.rs')
-rw-r--r--cli/ops/fs.rs15
1 files changed, 5 insertions, 10 deletions
diff --git a/cli/ops/fs.rs b/cli/ops/fs.rs
index 204d447be..720a4db52 100644
--- a/cli/ops/fs.rs
+++ b/cli/ops/fs.rs
@@ -2,6 +2,7 @@
// Some deserializer fields are only used on Unix and Windows build fails without it
use super::io::std_file_resource;
use super::io::{FileMetadata, StreamResource, StreamResourceHolder};
+use crate::fs::canonicalize_path;
use crate::permissions::Permissions;
use deno_core::error::custom_error;
use deno_core::error::type_error;
@@ -934,11 +935,8 @@ fn op_realpath_sync(
debug!("op_realpath_sync {}", path.display());
// corresponds to the realpath on Unix and
// CreateFile and GetFinalPathNameByHandle on Windows
- let realpath = std::fs::canonicalize(&path)?;
- let mut realpath_str = into_string(realpath.into_os_string())?;
- if cfg!(windows) {
- realpath_str = realpath_str.trim_start_matches("\\\\?\\").to_string();
- }
+ let realpath = canonicalize_path(&path)?;
+ let realpath_str = into_string(realpath.into_os_string())?;
Ok(json!(realpath_str))
}
@@ -963,11 +961,8 @@ async fn op_realpath_async(
debug!("op_realpath_async {}", path.display());
// corresponds to the realpath on Unix and
// CreateFile and GetFinalPathNameByHandle on Windows
- let realpath = std::fs::canonicalize(&path)?;
- let mut realpath_str = into_string(realpath.into_os_string())?;
- if cfg!(windows) {
- realpath_str = realpath_str.trim_start_matches("\\\\?\\").to_string();
- }
+ let realpath = canonicalize_path(&path)?;
+ let realpath_str = into_string(realpath.into_os_string())?;
Ok(json!(realpath_str))
})
.await