mirror of
https://github.com/helix-editor/helix.git
synced 2025-01-18 21:17:08 +04:00
Use the OS path separator instead of / (#10000)
This commit is contained in:
parent
614a744d24
commit
1d1087822a
@ -3,7 +3,7 @@
|
||||
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 @@ pub fn fold_home_dir<'a, P>(path: P) -> Cow<'a, Path>
|
||||
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));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user