Skip to content

Commit

Permalink
Use the OS path separator instead of / (helix-editor#10000)
Browse files Browse the repository at this point in the history
  • Loading branch information
mo8it authored and postsolar committed Apr 4, 2024
1 parent 79f0421 commit 3ab2f52
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions helix-stdx/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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));
}
Expand Down

0 comments on commit 3ab2f52

Please sign in to comment.