mirror of
https://github.com/Myriad-Dreamin/tinymist.git
synced 2025-11-23 12:46:43 +00:00
fix: correct rename on unix platforms caused by pathdiff#8 (#1587)
* fix: correct rename on unix platforms caused by pathdiff#8 * fix: ensure all calls to pathdiff * fix: names * fix: file path on windows
This commit is contained in:
parent
c102ace9ab
commit
e4a4fc568f
19 changed files with 44 additions and 28 deletions
|
|
@ -465,10 +465,12 @@ pub(crate) fn file_path(uri: &str) -> String {
|
|||
} else {
|
||||
PathBuf::from("/root")
|
||||
};
|
||||
let uri = uri.replace("file://", "");
|
||||
let abs_path = Path::new(&uri).strip_prefix(root).map(|s| s.as_os_str());
|
||||
let rel_path = abs_path.unwrap_or_else(|_| Path::new(&uri).file_name().unwrap());
|
||||
unix_slash(Path::new(rel_path.to_str().unwrap()))
|
||||
let uri = lsp_types::Url::parse(uri).unwrap().to_file_path().unwrap();
|
||||
let abs_path = Path::new(&uri).strip_prefix(root).map(|p| p.to_owned());
|
||||
let rel_path =
|
||||
abs_path.unwrap_or_else(|_| Path::new("-").join(Path::new(&uri).iter().last().unwrap()));
|
||||
|
||||
unix_slash(&rel_path)
|
||||
}
|
||||
|
||||
pub struct HashRepr<T>(pub T);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue