aboutsummaryrefslogtreecommitdiffstats
path: root/pyGHDL/lsp
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2021-01-16 16:07:53 +0100
committerTristan Gingold <tgingold@free.fr>2021-01-16 16:07:53 +0100
commit3caf1b762a8a784d27290b3b52a89ab3c20b6049 (patch)
tree0eac6ceb7707dd12b94253c0638e03104e8ce137 /pyGHDL/lsp
parentd95bbfc2163378d23ef24c7d838eaf3b76af4b9e (diff)
downloadghdl-3caf1b762a8a784d27290b3b52a89ab3c20b6049.tar.gz
ghdl-3caf1b762a8a784d27290b3b52a89ab3c20b6049.tar.bz2
ghdl-3caf1b762a8a784d27290b3b52a89ab3c20b6049.zip
pyGHDL: tentatively fix tests failure
Diffstat (limited to 'pyGHDL/lsp')
-rw-r--r--pyGHDL/lsp/lsp.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/pyGHDL/lsp/lsp.py b/pyGHDL/lsp/lsp.py
index eaa0cdfac..caaef6b2e 100644
--- a/pyGHDL/lsp/lsp.py
+++ b/pyGHDL/lsp/lsp.py
@@ -36,11 +36,13 @@ class LSPConn:
def path_from_uri(uri):
# Convert file uri to path (strip html like head part)
if not uri.startswith("file://"):
+ # No scheme
return uri
- if os.name == "nt":
- _, path = uri.split("file:///", 1)
- else:
- _, path = uri.split("file://", 1)
+ _, path = uri.split("file://", 1)
+ if os.name == "nt" and path.startswith("/"):
+ # On windows, absolute files start like "/C:/aa/bbb".
+ # Remove the first "/".
+ path = path[1:]
return os.path.normpath(unquote(path))