Convert Windows style path separator in completers to Unix style (#1389)
This commit is contained in:
parent
8c29b76bcc
commit
49444f9c05
1 changed files with 7 additions and 2 deletions
|
@ -313,7 +313,7 @@ pub mod completers {
|
|||
return None;
|
||||
}
|
||||
|
||||
//let is_dir = entry.file_type().map_or(false, |entry| entry.is_dir());
|
||||
let is_dir = entry.file_type().map_or(false, |entry| entry.is_dir());
|
||||
|
||||
let path = entry.path();
|
||||
let mut path = if is_tilde {
|
||||
|
@ -331,7 +331,12 @@ pub mod completers {
|
|||
path.push("");
|
||||
}
|
||||
|
||||
let path = path.to_str().unwrap().to_owned();
|
||||
let path = if cfg!(windows) && is_dir {
|
||||
// Convert Windows style path separator to Unix style
|
||||
path.to_str().unwrap().replace("\\", "/")
|
||||
} else {
|
||||
path.to_str().unwrap().to_owned()
|
||||
};
|
||||
Some((end.clone(), Cow::from(path)))
|
||||
})
|
||||
}) // TODO: unwrap or skip
|
||||
|
|
Loading…
Add table
Reference in a new issue