summaryrefslogtreecommitdiff
path: root/cli/ops/fs.rs
diff options
context:
space:
mode:
authorNayeem Rahman <nayeemrmn99@gmail.com>2020-10-07 13:05:43 +0100
committerGitHub <noreply@github.com>2020-10-07 14:05:43 +0200
commitc226d3af2572c93af21f5a3261ede4dd8855685e (patch)
tree43a8e1955b12ddc3b6be274b857921b04f91f89a /cli/ops/fs.rs
parent99aa23b8ddd73ab6332430c2ba7c44792fad3886 (diff)
fix(cli/ops/fs): Don't force Windows paths separate paths with forward slash (#7833)
Diffstat (limited to 'cli/ops/fs.rs')
-rw-r--r--cli/ops/fs.rs10
1 files changed, 4 insertions, 6 deletions
diff --git a/cli/ops/fs.rs b/cli/ops/fs.rs
index c5d1458fc..8542b5230 100644
--- a/cli/ops/fs.rs
+++ b/cli/ops/fs.rs
@@ -941,10 +941,9 @@ fn op_realpath_sync(
// 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())?.replace("\\", "/");
+ let mut realpath_str = into_string(realpath.into_os_string())?;
if cfg!(windows) {
- realpath_str = realpath_str.trim_start_matches("//?/").to_string();
+ realpath_str = realpath_str.trim_start_matches("\\\\?\\").to_string();
}
Ok(json!(realpath_str))
}
@@ -971,10 +970,9 @@ async fn op_realpath_async(
// 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())?.replace("\\", "/");
+ let mut realpath_str = into_string(realpath.into_os_string())?;
if cfg!(windows) {
- realpath_str = realpath_str.trim_start_matches("//?/").to_string();
+ realpath_str = realpath_str.trim_start_matches("\\\\?\\").to_string();
}
Ok(json!(realpath_str))
})