mirror of
https://github.com/joshuadavidthomas/django-language-server.git
synced 2025-08-04 01:58:18 +00:00
fix path_str on windows
This commit is contained in:
parent
7ef503d866
commit
2dacbb0056
1 changed files with 5 additions and 4 deletions
|
@ -29,12 +29,13 @@ fn uri_to_pathbuf(uri: &Uri) -> Option<PathBuf> {
|
||||||
|
|
||||||
// Decode the percent-encoded path string
|
// Decode the percent-encoded path string
|
||||||
let decoded_path_cow = percent_decode_str(encoded_path_str).decode_utf8_lossy();
|
let decoded_path_cow = percent_decode_str(encoded_path_str).decode_utf8_lossy();
|
||||||
|
|
||||||
#[cfg(unix)]
|
|
||||||
let path_str = decoded_path_cow.as_ref();
|
let path_str = decoded_path_cow.as_ref();
|
||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
// Remove leading '/' for paths like /C:/...
|
let path_str = {
|
||||||
let path_str = path_str.strip_prefix('/').unwrap_or(path_str);
|
// Remove leading '/' for paths like /C:/...
|
||||||
|
path_str.strip_prefix('/').unwrap_or(path_str)
|
||||||
|
};
|
||||||
|
|
||||||
Some(PathBuf::from(path_str))
|
Some(PathBuf::from(path_str))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue