aboutsummaryrefslogtreecommitdiff
path: root/helix-stdx
diff options
context:
space:
mode:
authorMo2024-03-25 15:59:33 +0000
committerGitHub2024-03-25 15:59:33 +0000
commit1d1087822a3b91dfc6617e0d67bf4293ad4f38e2 (patch)
tree9c748a61c54905233c0579c5787b6c9fa60a517c /helix-stdx
parent614a744d24e54225eae2ad0d27719b81c0cf9a4d (diff)
Use the OS path separator instead of / (#10000)
Diffstat (limited to 'helix-stdx')
-rw-r--r--helix-stdx/src/path.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/helix-stdx/src/path.rs b/helix-stdx/src/path.rs
index ff2bffae..968596a7 100644
--- a/helix-stdx/src/path.rs
+++ b/helix-stdx/src/path.rs
@@ -3,7 +3,7 @@ pub use etcetera::home_dir;
use std::{
borrow::Cow,
ffi::OsString,
- path::{Component, Path, PathBuf},
+ path::{Component, Path, PathBuf, MAIN_SEPARATOR_STR},
};
use crate::env::current_working_dir;
@@ -18,7 +18,8 @@ where
if let Ok(home) = home_dir() {
if let Ok(stripped) = path.strip_prefix(&home) {
let mut path = OsString::with_capacity(2 + stripped.as_os_str().len());
- path.push("~/");
+ path.push("~");
+ path.push(MAIN_SEPARATOR_STR);
path.push(stripped);
return Cow::Owned(PathBuf::from(path));
}